Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

figure option dialog does not properly handle units #4909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 13, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
The figure option dialog resets the axes and all unit information. Th…
…is fixes

it so that unit information is not lost.
  • Loading branch information
James Evans committed Aug 12, 2015
commit 3377467310ed61c83ca0485e09ad48c8204c9d0d
16 changes: 15 additions & 1 deletion 16 lib/matplotlib/backends/qt_editor/figureoptions.py
Original file line number Diff line number Diff line change
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 @@ -101,7 +107,7 @@ def figure_edit(axes, parent=None):
has_curve = bool(curves)

datalist = [(general, "Axes", "")]
if has_curve:
if has_curve and curves:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the and curves doing?

datalist.append((curves, "Curves", ""))

def apply_callback(data):
Expand All @@ -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 )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP8: unnecessary spaces

axes.xaxis._update_axisinfo()
axes.yaxis._update_axisinfo()

if has_curve:
# Set / Curves
for index, curve in enumerate(curves):
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.