Skip to content

Commit

Permalink
Merge pull request matplotlib#23415 from dstansby/units-sample-ex
Browse files Browse the repository at this point in the history
Minor improvements to units_sample example
  • Loading branch information
QuLogic authored Jul 12, 2022
2 parents 8e177ba + 2ab4b05 commit 9d9ba8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/units/units_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

cms = cm * np.arange(0, 10, 2)

fig, axs = plt.subplots(2, 2)
fig, axs = plt.subplots(2, 2, constrained_layout=True)

axs[0, 0].plot(cms, cms)

axs[0, 1].plot(cms, cms, xunits=cm, yunits=inch)

axs[1, 0].plot(cms, cms, xunits=inch, yunits=cm)
axs[1, 0].set_xlim(3, 6) # scalars are interpreted in current units
axs[1, 0].set_xlim(-1, 4) # scalars are interpreted in current units

axs[1, 1].plot(cms, cms, xunits=inch, yunits=inch)
axs[1, 1].set_xlim(3*cm, 6*cm) # cm are converted to inches
Expand Down

0 comments on commit 9d9ba8a

Please sign in to comment.