-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Reduce object-oriented boilerplate for users #1125
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
Changes from all commits
700b26b
8bd1d57
f83fbc9
88e299b
8738c1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -512,3 +512,5 @@ def _save (self, fo, format, **kwargs): | |
|
||
ctx.show_page() | ||
surface.finish() | ||
|
||
FigureCanvas = FigureCanvasCairo |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -318,7 +318,7 @@ def __init__(self, | |
self.patch.set_aa(False) | ||
|
||
self._hold = rcParams['axes.hold'] | ||
self.canvas = None | ||
self.canvas = self._setup_canvas() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change means that I now get two TK widows popping up (one empty, one with a figure) with the following code:
Presumably this is true of all other backends too. Looks like we might have to implement @astrofrog 's suggestion of making this togglable (and have pyplot toggle that toggler). |
||
|
||
if subplotpars is None: | ||
subplotpars = SubplotParams() | ||
|
@@ -330,6 +330,14 @@ def __init__(self, | |
self.clf() | ||
self._cachedRenderer = None | ||
|
||
def _setup_canvas(self): | ||
""" | ||
Return the FigureCanvas instance defined by the currently loaded backend. | ||
""" | ||
import matplotlib.backends as mbackends # lazy import | ||
backend_mod = mbackends.pylab_setup()[0] | ||
return backend_mod.FigureCanvas(self) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if the module from The old There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @verbit Line 508 of FigureCanvas = FigureCanvasTkAgg so the return value of Perhaps this is actually a bug in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I saw this behaviour with IPython's custom backend (see: backend_inline.py) that doesn't return a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in #1214. |
||
|
||
def _get_axes(self): | ||
return self._axstack.as_list() | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be FigureCanvasGTKAgg (and moved after the definition of FigureCanvasGTKAgg). At least this doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Yes. Good spot. I will open another PR to address this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, GtkAgg backend currently does not work, which I believe is due to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry! Fixed in #1201.