Skip to content
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

lib.pylabtools.figsize : NameError when using Qt4Agg backend and %pylab magic. #2630

Closed
SylvainCorlay opened this issue Nov 29, 2012 · 3 comments · Fixed by #3568
Closed
Labels
Milestone

Comments

@SylvainCorlay
Copy link
Member

Hello,
When using the pylab magic with the QtAgg backend for matplotlib, function lib.pylabtools.figsize is not imported.

This is probably "by design" but it unfortunate that one has to change ones code when changing "%pylab inline" into "%pylab" to have the graphs pop up instead of being inline.

Way to reproduce:

  1. In a new ipython notebook (do not start with --pylab inline)
In [1]: %pylab inline
Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].
For more information, type 'help(pylab)'.
In [2]: figsize(2,2)

No error occurs

  1. In a new ipython notebook (do not start with --pylab inline)
In [1]: %pylab
Welcome to pylab, a matplotlib-based Python environment [backend: Qt4Agg].
For more information, type 'help(pylab)'.
In [2]: figsize(2,2)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-1d42e6d441df> in <module>()
----> 1 figsize(2,2)
    NameError: name 'figsize' is not defined
@ivanov
Copy link
Member

ivanov commented Nov 30, 2012

I can confirm this behavior - not sure if we should make figsize available in both cases or neither case.

@fperez wrote that code almost exactly a year ago, but he'll have very limited connectivity in the coming weeks.

The relevant lines are in IPython/core/pylabtools.py:301-302.

I'd actually prefer to move this code out to matplotlib - because we don't want to start creating asymmetries where the code will run in IPython but not in Python, since by also attaching figsize to plt.figsize we are wrongly giving the impressions to users of the plt interface that figsize is a standard method there.

@takluyver
Copy link
Member

...I confess I did think figsize was part of pyplot. You have a good point.
;-)

@takluyver
Copy link
Member

@ivanov - what do you want to do about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants