Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log scale with zero data should give a better warning #3911

Closed
jowens opened this issue Jun 21, 2018 · 8 comments
Closed

log scale with zero data should give a better warning #3911

jowens opened this issue Jun 21, 2018 · 8 comments

Comments

@jowens
Copy link

jowens commented Jun 21, 2018

In Altair, I had a column of data that I plotted on a log scale:

sh = Chart(df).mark_point().encode(
    x='Launch:T',
    y=Y('Pixel/unified shader count:Q',
        scale=Scale(type='log'),
        ),

and a zero snuck into the column that I didn't know about and the debugging of that took a really really long time. Here's what Altair output looked like:

image

I guess I would have expected that the zeroes would be silently dropped OR the console would have thrown a warning ... anyway, the Altair output was perplexing. One zero out of several hundred data points made everything plot on a single line.

@jakevdp suggested this was the right place to raise the issue (vega/altair#953).

@domoritz
Copy link
Member

Vega-Lite actually never sees the data so the warning would need to be in Vega.

@jowens
Copy link
Author

jowens commented Jun 21, 2018

@domoritz should I go file this in vega's issues?

@domoritz
Copy link
Member

One thing we could do in Vega-Lite is automatically filter out values less or equal to zero (in https://github.com/vega/vega-lite/blob/master/src/compile/data/filterinvalid.ts) but that seems like it could have all kinds of bad effects.

Yes, I think this needs to be in Vega itself.

@kanitw
Copy link
Member

kanitw commented Jun 21, 2018

One thing we could do in Vega-Lite is automatically filter out values less or equal to zero (in /src/compile/data/filterinvalid.ts@master) but that seems like it could have all kinds of bad effects.

We used to, but not any more. (Look at the code you link to.)

@domoritz
Copy link
Member

What do you mean? I know that we used to and we don't right now but I linked to the code where we would add this functionality.

@g3o2
Copy link
Contributor

g3o2 commented Jun 21, 2018

wouldn't it be better to plot the invalid values as missing values?

@domoritz
Copy link
Member

@g3o2 yes. We haven't figured out a good way to show missing values in all chart types.

@kanitw
Copy link
Member

kanitw commented Jun 21, 2018

What do you mean? I know that we used to and we don't right now but I linked to the code where we would add this functionality.

Oh I see. We intentionally remove that filter because it's magical so I don't think we should add it back. Plus, D3 log scale works with either strictly positive or strictly negative values, so it's quite tricky to write the right filter.

wouldn't it be better to plot the invalid values as missing values?

Yes, but invalid values is also a part of scale domain and thus it will break the scale like shown in the screenshot at the top of this issue. Filtering it correctly can be tricky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants