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

Skip to content

Surprising behavior of shared axes with categorical units #18273

Closed
@mwaskom

Description

@mwaskom

Bug report

Setting categorical units on an axis that is shared across subplots updates the units on its siblings, but not the order of the units.

Code for reproduction

f, axs = plt.subplots(1, 2, sharex=True)
axs[0].xaxis.update_units(["a", "c", "b"])
axs[1].plot(["a", "b", "c"], [1, 2, 3])

Actual outcome

image

Expected outcome

Compare to:

f, axs = plt.subplots(1, 2, sharex=True)
axs[0].xaxis.update_units(["a", "c", "b"])
axs[0].plot(["a", "b", "c"], [1, 2, 3])

image

Matplotlib version

  • Operating system:
  • Matplotlib version: 3.3.0
  • Matplotlib backend (print(matplotlib.get_backend())): pylab inline
  • Python version: 3.8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions