From 88ed2c8bbbfea1be990f93bc6491a9973f1db2e3 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Mon, 20 Mar 2023 18:42:08 -0500 Subject: [PATCH] DOC: Fix the bars having numeric value of cm but labeled as inches This is admittedly more of a band-aid than a proper fix, but at least make the generated figure correct. The underlying problem is the more fundemental one of inconsistent units behavior in which some artists can be re-united after plotting (e.g. Line2D), while many others (e.g. Collections) cannot. Thus, until that is addressed (which is one of the goals of the data-prototype work), simply setting units early is as good as we can do. Closes #5051 --- galleries/examples/units/bar_unit_demo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galleries/examples/units/bar_unit_demo.py b/galleries/examples/units/bar_unit_demo.py index 18e2c00b699e..05e0dfad902d 100644 --- a/galleries/examples/units/bar_unit_demo.py +++ b/galleries/examples/units/bar_unit_demo.py @@ -22,6 +22,7 @@ tea_std = [2*cm, 1*cm, 1*cm, 4*cm, 2*cm] fig, ax = plt.subplots() +ax.yaxis.set_units(inch) ind = np.arange(N) # the x locations for the groups width = 0.35 # the width of the bars @@ -36,7 +37,6 @@ ax.set_xticks(ind + width / 2, labels=['G1', 'G2', 'G3', 'G4', 'G5']) ax.legend() -ax.yaxis.set_units(inch) ax.autoscale_view() plt.show()