value ascending / value descending
See original GitHub issueI’m making categorical histograms (with and without z
and histfunc: sum
). I’d like to be able to sort these histograms in descending by value order without using transforms.
Maybe this would fit under categoryorder: 'value ascending'
and categoryorder: 'value descending'
? https://github.com/plotly/plotly.js/pull/419/files#diff-0e41c2e162564438ff091d0ed6b5b455R472
Issue Analytics
- State:
- Created 5 years ago
- Comments:32 (32 by maintainers)
Top Results From Across the Web
How to sort a dictionary by value (DESC) then by key (ASC)?
and I need to sort it in descending order of its integer values, but if two elements where to have same value, then...
Read more >Python: Sort (ascending and descending) a dictionary by value
Python Exercises, Practice and Solution: Write a Python program to sort (ascending and descending) a dictionary by value.
Read more >What Is Descending Order? Definition, Symbol, Rules, Examples
The opposite of descending order is known as ascending order, in which the numbers are arranged from lower value to higher value.
Read more >Python: Sort a dictionary by value - thisPointer
In this article we will discuss different ways to sort a python dictionary by values in both ascending & descending order using sorted()...
Read more >Sort first k values in ascending order and remaining n-k values ...
Given an array of size n, arrange the first k elements of the array in ascending order and the remaining n-k elements in...
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
wanted to braindump part of a conversation I had with @antoinerg here. It’s not critical to resolve this for 1.48 but I want to make sure we don’t lock ourselves out of a more complete API.
It seems that in
categoryorder = "value (a|de)scending"
mode there are at least 3 extra pieces of information we need to specify the flavours of ordering I can imagine:The motivation for 1 is that I might want to sort the axis by a single trace, and we’d likely want to specify a way of breaking ties, so in extremis we’d want to allow an exhaustive ordered list, and we’d also want to specify “no among-trace order preference”.
The motivation for 2 is that in the case of grouped bars at least, I might want to sort by the height of the maximum stack, rather than the maximum single element.
The motivation for 3 is pretty clear: we need to aggregate somehow.
Taking just the case of 3 and 2 together, we might imagine an attr that takes two functions that interact such that my max-stack idea would be “max sum”. In that case, the options that @antoinerg already implemented already work nicely as “max max”, “min min” and “sum sum”. It would also allow us to do something like “mean median” to order grouped box-plots in a particular way. Not all options make sense, clearly, such as “min max” or “mean mean” or “median median” so we could imagine a world where we enumerate the options perhaps.
So in terms of a half-baked attempt at an API, we could accept two attrs: a composite aggregation function that accepts
"sum"
,"max sum"
and friends (default=sum
?), and a trace-scope array that defaults to[]
meaning “no preference” but accepts an ordered list of …trace.uid
s? trace indices?You could say the same about
category (ascending|descending)
- ascending will puta
at the bottom ande
at the top so they’re actually in reverse alphabetical order. In fact you could even make that argument about the order based on data in the trace.I guess with a categorical Y axis you generally do read the graph from top to bottom, as opposed to numerical axes that you almost always read bottom to top. But making that the default behavior I think has much more extensive consequences than just choosing it for the new feature. So unless we’re prepared to alter the rest of that behavior, I think ascending has to put the biggest at the top.