Skip to content

Commit b9bc7d1

Browse files
committed
Merge pull request matplotlib#4909 from jrevans/issue06
FIX: Qt figure options preserve units
2 parents f8ceb85 + e5940b7 commit b9bc7d1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/matplotlib/backends/qt_editor/figureoptions.py

+14
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ def figure_edit(axes, parent=None):
6363
('(Re-)Generate automatic legend', False),
6464
]
6565

66+
# Save the unit data
67+
xconverter = axes.xaxis.converter
68+
yconverter = axes.yaxis.converter
69+
xunits = axes.xaxis.get_units()
70+
yunits = axes.yaxis.get_units()
71+
6672
if has_curve:
6773
# Get / Curves
6874
linedict = {}
@@ -122,6 +128,14 @@ def apply_callback(data):
122128
axes.set_ylim(ymin, ymax)
123129
axes.set_ylabel(ylabel)
124130

131+
# Restore the unit data
132+
axes.xaxis.converter = xconverter
133+
axes.yaxis.converter = yconverter
134+
axes.xaxis.set_units(xunits)
135+
axes.yaxis.set_units(yunits)
136+
axes.xaxis._update_axisinfo()
137+
axes.yaxis._update_axisinfo()
138+
125139
if has_curve:
126140
# Set / Curves
127141
for index, curve in enumerate(curves):

0 commit comments

Comments
 (0)