Skip to content

display only category label on axis for multicategory plots #3884

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

Open
aamster opened this issue May 21, 2019 · 8 comments
Open

display only category label on axis for multicategory plots #3884

aamster opened this issue May 21, 2019 · 8 comments
Labels
feature something new P3 backlog

Comments

@aamster
Copy link

aamster commented May 21, 2019

I would like to display only the category, and not the specific tick labels on the axis. For example, in this example https://codepen.io/plotly/pen/bOByWR I would like to only display 'SF Zoo' and 'LA Zoo'. I've tried several hacks such as setting tick labels to empty string, but in my case the plot still leaves room for the tick labels and it looks weird. See what I mean:
image

Is there a way to accomplish this? I think I might have to use the idea of subcategory axis instead.

@aamster
Copy link
Author

aamster commented May 21, 2019

I was able to do it by setting the tick labels to be different length empty strings and then rotating ticklabels 0 degrees.

@etpinard
Copy link
Contributor

Hi @aamster Thanks for writing in!

Can I ask why you're trying to plot your data on a multicategory axis if you only want to see one category level?

@etpinard
Copy link
Contributor

etpinard commented May 21, 2019

We could certainly add an attribute named e.g. hideinnerlabels:false to do what you're requesting, but more context would help us make an informed decision.

Thanks again!

@aamster
Copy link
Author

aamster commented May 21, 2019

@etpinard I essentially wanted a single category label to span multiple ticks, since there are too many individual tick labels to display. I can then hover over each individual bar to see what that bar represents. Here's a truncated finished version:

Screenshot from 2019-05-21 17-01-54

@etpinard
Copy link
Contributor

Thanks for replying!

Have you tried using tickvals and ticktext as in https://codepen.io/etpinard/pen/mYqjVP ?

@aamster
Copy link
Author

aamster commented May 21, 2019

@etpinard that's interesting but you still have to set empty string to all but one of ticktext and then set the middle ticktext to the category value. It's still better than my solution I think.

@etpinard
Copy link
Contributor

@aamster right by codepen was meant to be a workaround.

I agree something is missing from our current multicategory implementation. Maybe a new boolean (e.g. hideinnerlabels:false, but how would that work with #2175) or maybe we should extend tickext and tickvals to multicategory axes.

I'll tag your ticket under type: feature. Thanks very much for posting!

@etpinard etpinard added the feature something new label May 21, 2019
@willleeney
Copy link

please add this feature

@gvwilson gvwilson self-assigned this Jun 14, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson changed the title Multicategory -- display only category label on axis display only category label on axis for multicategory plots Aug 8, 2024
@gvwilson gvwilson added the P3 backlog label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 backlog
Projects
None yet
Development

No branches or pull requests

4 participants