Skip to content

Commit

Permalink
Merge pull request #4909 from jrevans/issue06
Browse files Browse the repository at this point in the history
FIX: Qt figure options preserve units
  • Loading branch information
tacaswell committed Sep 13, 2015
2 parents f8ceb85 + e5940b7 commit b9bc7d1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/matplotlib/backends/qt_editor/figureoptions.py
Expand Up @@ -63,6 +63,12 @@ def figure_edit(axes, parent=None):
('(Re-)Generate automatic legend', False),
]

# Save the unit data
xconverter = axes.xaxis.converter
yconverter = axes.yaxis.converter
xunits = axes.xaxis.get_units()
yunits = axes.yaxis.get_units()

if has_curve:
# Get / Curves
linedict = {}
Expand Down Expand Up @@ -122,6 +128,14 @@ def apply_callback(data):
axes.set_ylim(ymin, ymax)
axes.set_ylabel(ylabel)

# Restore the unit data
axes.xaxis.converter = xconverter
axes.yaxis.converter = yconverter
axes.xaxis.set_units(xunits)
axes.yaxis.set_units(yunits)
axes.xaxis._update_axisinfo()
axes.yaxis._update_axisinfo()

if has_curve:
# Set / Curves
for index, curve in enumerate(curves):
Expand Down

0 comments on commit b9bc7d1

Please sign in to comment.