Thanks to visit codestin.com
Credit goes to github.com

Skip to content

categorical axis sorts its keys #9312

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

Closed
anntzer opened this issue Oct 8, 2017 · 1 comment
Closed

categorical axis sorts its keys #9312

anntzer opened this issue Oct 8, 2017 · 1 comment

Comments

@anntzer
Copy link
Contributor

anntzer commented Oct 8, 2017

Bug report

Bug summary

Categorical (i.e. string) xdata inputs get sorted before plotting.

Code for reproduction

plt.bar(["b", "a", "c"], [2, 1, 3])

Actual outcome

Bars appear in the order "a", "b", "c".

Expected outcome

Bars appear in the order of the input, so "b", "a", "c".

Matplotlib version

  • Operating system: Arch Linux
  • Matplotlib version: 2.1
  • Matplotlib backend (print(matplotlib.get_backend())): qt5agg
  • Python version: 3.6
  • Jupyter version (if applicable):
  • Other libraries:
@story645
Copy link
Member

closed by #9783 though the jpl implementation of strconvertor has me thinking we should support sorted and unsorted by stashing the info in the plot kwarg arg and as an attribute on unitdata.

hfswetton added a commit to hfswetton/vcs-automat-misc that referenced this issue Nov 9, 2021
Add lines 104/106 & edit line 105 to first plot each weekday as a number and then overwrite with the actual day. Prevents the weekdays being sorted alphabetically due to this bug in Matplotlib < 2.2.0: matplotlib/matplotlib#9312
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants