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

Make default dimension name of a histogram be less generic #1776

Closed
timothydmorton opened this issue Aug 2, 2017 · 10 comments
Closed

Make default dimension name of a histogram be less generic #1776

timothydmorton opened this issue Aug 2, 2017 · 10 comments
Milestone

Comments

@timothydmorton
Copy link

Because a y-axis of a histogram gets the generic name "Frequency", two axes in the same layout end up linked by default, even if that doesn't make sense. It might be better to have the frequency dimension named after the name of the dimension being histogrammed; e.g., "x Frequency" or "x Count".

@jlstevens
Copy link
Contributor

I am in favor of this change as an 'x Frequency' dimension is not the same as a 'y Frequency' dimension.

@jbednar
Copy link
Member

jbednar commented Aug 2, 2017

Sounds like a straightforward change; if you want to make a PR it would force us to do it soon! :-)

@philippjfr
Copy link
Member

Here is where you'd have to define a value dimension (vdim): https://github.com/ioam/holoviews/blob/master/holoviews/operation/element.py#L555

@timothydmorton
Copy link
Author

So I can change the name of the vdim and it works as hoped for (axes are not linked), but testing it out, I notice that the axes seem to be linked based on the label of the dimension, not its short name. That is, if I say vdims=[(selected_dim + '_frequency', 'Frequency')], then an x-histogram and y-histogram in the same layout still get linked, presumably because they have the same label, despite having different names. Is this intentional? It would seem to me that axes should be linked if the dimensions match in name, rather than label.

I'm asking because I'd actually like the axis labels to just say "Frequency," because that's nice and clean, and when I see "x Frequency" and "y Frequency" it just looks awkward.

Should I create a different issue for automatic linking based on dimension name rather than label?

@jlstevens
Copy link
Contributor

It would seem to me that axes should be linked if the dimensions match in name, rather than label.

The identity of a dimension is defined by the name and label. This is a deliberate choice as one dimension should not have two longer descriptions of what it is!

Although a dimension name is expected to have a unique label, what you should be able to do here is hv.Dimension('x_frequency', label='Frequency') and hv.Dimension('y_frequency', label='Frequency'). Then these are considered two distinct dimensions which happen to have the same label...even though they are frequencies of two different types of thing.

If that doesn't work then I would consider it a bug - linking dimensions should not be done on the label alone.

@timothydmorton
Copy link
Author

Yes, this is what is happening for me-- the two axes are linked when the labels are the same, but the names are not. Any suggestions where I should look for this, so I can include a fix to this on the PR if possible?

@jlstevens
Copy link
Contributor

@philippjfr Any suggestions?

@philippjfr
Copy link
Member

Both the normalization system and bokeh axis linking code long precede the introduction of separate name and label attributes and therefore likely work based on the final axis label. This won't be a straightforward change as it involves changing a fair amount of the plotting code, but I agree it should be done at some point.

@jlstevens
Copy link
Contributor

We agree in principle then. Shame it will be a bigger job than I hoped and I think this should be the semantics for version 2.0. I'll assign that milestone to issue #1783.

@philippjfr philippjfr added this to the v1.9 milestone Sep 23, 2017
@philippjfr
Copy link
Member

Just merged #1836 so this has now been addressed.

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