Sorting categorical axes
See original GitHub issueFollowing up on https://github.com/pyviz/hvplot/issues/122, I think we should first decide if ordering is a part of the dimension declaration or of the styling options.
One solution would be, first of all, to respect the ordering of the hv.Dimension(values= )
kwarg, that’s not too hard I guess.
Beyond that, if we wanted to have ordering by, say, alphabetical, inverse alphabetical, length of label, whatever, or mean
/max
/etc, would that live in the styling options with a hook into redimensioning the values=
kwarg accordingly? Or something different?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
8.4 Changing the Order of Items on a Categorical Axis
For a categorical (or discrete) axis – one with a factor mapped to it – the order of items can be changed by...
Read more >Categorical axes in Python - Plotly
Over 11 examples of Categorical Axes including changing color, size, log axes, and more in ... Whether using Plotly Express or not, categories...
Read more >pandas sort x axis with categorical string values - Stack Overflow
I am trying to sort categorical variables in the pandas plot x axis. I tried sorting from pandas dataframe itself but I can...
Read more >JET Developer Cookbook - Categorical Axis: Sorting - Oracle
Cookbook navigation. Cookbook navigation. JET. Previous Common. Hierarchical Menu button. Cookbook; Visualizations; Chart. selected.
Read more >X-Axis Not Sorting in Categorical Order
X-Axis Not Sorting in Categorical Order. 02-27-2020 01:19 PM. My x-axis in the chart is going in a random order. I imagine this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Problem solved - see the end of the message.
I have a similar problem of not being able re-order the axis ticks on a holoviews heatmap:
Have anyone been in the same situation? And perhaps found a workaround?
I have tried @DancingQuanta’ workaround of overwriting the order of
hv_heatmap.data
, but without any luck.I want to change the order of the y-axis, because I’m changing my current implementation of a confusion matrix from matplotlib to holoviews, such that it gets the same format as seen here: https://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html
EDIT I solved the problem by using the
invert_yaxis=True
option flag (found it here: https://github.com/holoviz/datashader/issues/596#issuecomment-389324078).I’m having a similar issue as I explain in a question posted on stack. The solution isn’t fixed by inverting axes though. Any suggestions?