-
Notifications
You must be signed in to change notification settings - Fork 629
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
scale domain/range should not place items in legend if they are not in plot #2802
Comments
There is no clean way to do this in Vega as far as I know. I remember that we talked about domain mapping that specifies what colors items in the domain should be mapped to but I can't find the reference right now. Either way, we need support in Vega first so I'm closing this issue here. Please file an issue in Vega first. |
@jowens Thanks for filing an issue. However, conceptually, legend is a visualization of the scale. Thus if you set the scale However, a better alternative would to use a formula transform to derive a new field with specific color value and just the data value as the color. Our previous discussion of a "replace" transform could be handy for this task as well #1761. |
In Vega, you can control which values appear in a legend using the |
Oh yeah, if you want to manually change What I mention above is more like what could work natively in Vega-Lite in the future :) |
@kanitw Do you think we should wire up things in Vega-Lite to use the original domain of the scale to set the |
I dont think so. It will be extremely complicated to make it work correctly
with union domain.
The requested use case can be achieved cleaner and easier via formula+scale
disabling.
…On Tue, Aug 8, 2017 at 4:28 PM Dominik Moritz ***@***.***> wrote:
@kanitw <https://github.com/kanitw> Do you think we should wire up things
in Vega-Lite to use the original domain of the scale to set the values of
the legends? Even if you or I don't implement this right now, we could mark
this as "help wanted".
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2802 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGypbqjDDZKLGLOpKPxqLr3exxHBdMiks5sWO8pgaJpZM4OwDoy>
.
|
Actually I'm a bit wrong -- if we disable scale, then there would be no legend. Hmm, I'll re-open this for now then. Not sure what's the best solution yet. |
Thanks for always taking my issues seriously, whether they're good, bad, or weird. |
In the above example, I don't quite understand how it would be more tedious to provide a manual |
@g3o2 My use case is one defined domain/range scale, many graphs. Consider if I have dozens of vendors and each one gets its own (custom) color, but any individual graph has only a small subset of the total number of vendors. I can't address your question. |
Closing as it appears to be no clear solution here. I think this is a bit too complicated to support natively in Vega-Lite -- better just do it in Vega or D3. If you have a good proposal, please feel free to reopen and propose one. |
This was an Altair graph. I wanted to assign colors to vendors using a domain/range
Scale
and make many graphs with thatScale
. Some graphs do not have all vendors. I expected that only the vendors that appeared in the graph would appear in the legend. (Consider an uber-Scale
that has hundreds of items in domain/range but only a few appear in any particular graph.)In the JSON below (VL 2.0.0-beta.11) I see both AMD and NVIDIA in the legend, but only NVIDIA points appear in the graph, so I expect only NVIDIA should be in the legend.
The text was updated successfully, but these errors were encountered: