- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.9k
sort categorical Cartesian axes by value #3864
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
Changes from 4 commits
9c09d8c
              2d379f7
              e4e5eaa
              76683ba
              fac239b
              67cc14d
              c6e049b
              7c8d52b
              54b3ff9
              9aaa10b
              553e193
              bf6bdf3
              d13542e
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| { | ||
| "data": [{ | ||
| "x": ["a", "b", "c", "a", "b", "d", "b", "c", "b", "b"], | ||
| "type": "histogram" | ||
| }, | ||
| { | ||
| "x": ["d", "c", "a", "e", "a"], | ||
| "type": "histogram" | ||
| }, | ||
| { | ||
| "y": ["a", "b", "c", "a", "b", "d", "b", "c"], | ||
| "type": "histogram", | ||
| "xaxis": "x2", | ||
| "yaxis": "y2" | ||
| }, | ||
| { | ||
| "y": ["d", "c", "b", "a", "e", "a", "b"], | ||
| "type": "histogram", | ||
| "xaxis": "x2", | ||
| "yaxis": "y2" | ||
| }], | ||
| "layout": { | ||
| "title": "categoryorder: \"value ascending\"", | ||
| "height": 400, | ||
| "width": 600, | ||
| "barmode": "stack", | ||
| "xaxis": { | ||
| "domain": [0, 0.45], | ||
| "categoryorder": "value ascending" | ||
| }, | ||
| "xaxis2": { | ||
| "domain": [0.55, 1] | ||
| }, | ||
| "yaxis2": { | ||
| "anchor": "x2", | ||
| "categoryorder": "value ascending" | ||
| } | ||
| } | ||
| } | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "data": [ | ||
| { | ||
| "x": ["a", "b", "c", "d"], | ||
| "y": [4, 2, 3, 1], | ||
| "type": "scatter", | ||
| "mode": "markers" | ||
| }, | ||
| { | ||
| "x": ["a", "b", "c", "d", "c", "c"], | ||
| "type": "histogram" | ||
| } | ||
| ], | ||
| "layout": { | ||
| "title": "xaxis.categoryorder: \"value descending\"", | ||
| "width": 400, | ||
| "height": 400, | ||
| "xaxis": { | ||
| "domain": [ | ||
| 0, | ||
| 1 | ||
| ], | ||
| "categoryorder": "value descending" | ||
| } | ||
| } | ||
| } | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "data": [{ | ||
| "type": "scatter", | ||
| "orientation": "v", | ||
| "x": ["a", "b", "c"], | ||
| "y": [7, 2, 3] | ||
| }, { | ||
| "type": "bar", | ||
| "x": ["a", "b", "c"], | ||
| "y": [10, 20, 30], | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. I don't understand why the categories show up as  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
 At the moment, not if they are on a different axis: only the traces associated with the axis to be sorted are accounted for. In this mock, the  We could account for the values of all traces across all matching axes IF we also support a way to specify traces to ignore as suggested by @nicolaskruchten (see #3606 (comment)) so that we can reproduce the current baseline. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
 Thanks for the explanation. That makes perfect sense 👍 | ||
| "yaxis": "y2", | ||
| "xaxis": "x2" | ||
| }], | ||
| "layout": { | ||
| "xaxis": { | ||
| "type": "category", | ||
| "categoryorder": "value ascending" | ||
| }, | ||
| "xaxis2": { | ||
| "matches": "x" | ||
| }, | ||
| "yaxis": { | ||
| "domain": [0, 0.45] | ||
| }, | ||
| "yaxis2": { | ||
| "domain": [0.55, 1] | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.