[matplotlib-devel] 1.1.1rc does not fix tight_layout for figtext?

2012-03-28 Thread Neal Becker
I just tried 1.1.1rc to see if it fixed the tight_layout for figtext.  

I have a semilogy plot, and add  some lines of text on the bottom (and top):

plt.figtext (0, 0, res['carriers'].values, horizontalalignment='left', 
verticalalignment='bottom', size=5)
plt.figtext (0.5, 1, self.pageno, horizontalalignment='left', 
verticalalignment='top', size='x-small')
##plt.tight_layout(pad=1.0)
plt.tight_layout()

The text on the bottom is overprinting the x axis - the same as happened  with 
the previous release.


--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] 1.1.1rc RuntimeError: underlying C/C++ object has been deleted

2012-03-28 Thread Neal Becker
I'm getting these messages, which did not occur with 1.1:

Traceback (most recent call last):
  File "/home/nbecker/.local/lib/python2.7/site-
packages/matplotlib/backends/backend_qt4.py", line 151, in 
lambda: self.close_event())
  File "/home/nbecker/.local/lib/python2.7/site-
packages/matplotlib/backend_bases.py", line 1564, in close_event
self.callbacks.process(s, event)
RuntimeError: underlying C/C++ object has been deleted


--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] 1.1.1rc does not fix tight_layout for figtext?

2012-03-28 Thread Jae-Joon Lee
I'm afraid that, unfortunately, it won't be fixed soon (if ever, as
far as I can tell).
What "tight_layout" does is to adjust the *subplot parameters* of the
figure so that the "subplots" fit in. Artists created with figtext
command is not affected by the subplot parameters, i.e. there is not
much thing we can do for these artists within the current
implementation. It would be better if some warning is printed in such
case (there are lots of cases that tight_layout will fail), but this
is not currently done.

Depending on your need, you may leave out some area for figtext when
you call "tight_layout". This is only supported for gridspec though.

import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec

fig = plt.figure()

gs1 = gridspec.GridSpec(2, 2)
ax_list = [fig.add_subplot(ss) for ss in gs1]

fig.text (02, 0, "test", horizontalalignment='left',
  verticalalignment='bottom', size=5)
fig.text (0.5, 1, "01", horizontalalignment='left',
  verticalalignment='top', size='x-small')

gs1.tight_layout(fig, rect=[0, 0.03, 1, 0.97]) # adjust rect parameter
to make some room for figtext.


Regards,

-JJ


On Wed, Mar 28, 2012 at 9:17 PM, Neal Becker  wrote:
> I just tried 1.1.1rc to see if it fixed the tight_layout for figtext.
>
> I have a semilogy plot, and add  some lines of text on the bottom (and top):
>
>        plt.figtext (0, 0, res['carriers'].values, horizontalalignment='left',
> verticalalignment='bottom', size=5)
>        plt.figtext (0.5, 1, self.pageno, horizontalalignment='left',
> verticalalignment='top', size='x-small')
>        ##plt.tight_layout(pad=1.0)
>        plt.tight_layout()
>
> The text on the bottom is overprinting the x axis - the same as happened  with
> the previous release.
>
>
> --
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> ___
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] 1.1.1rc does not fix tight_layout for figtext?

2012-03-28 Thread Neal Becker
If I have to manually add room, I guess I might as well just keep using this, 
which I had used with version 1.1:

fig.subplots_adjust(bottom=0.2)

Jae-Joon Lee wrote:

> I'm afraid that, unfortunately, it won't be fixed soon (if ever, as
> far as I can tell).
> What "tight_layout" does is to adjust the *subplot parameters* of the
> figure so that the "subplots" fit in. Artists created with figtext
> command is not affected by the subplot parameters, i.e. there is not
> much thing we can do for these artists within the current
> implementation. It would be better if some warning is printed in such
> case (there are lots of cases that tight_layout will fail), but this
> is not currently done.
> 
> Depending on your need, you may leave out some area for figtext when
> you call "tight_layout". This is only supported for gridspec though.
> 
> import matplotlib.pyplot as plt
> import matplotlib.gridspec as gridspec
> 
> fig = plt.figure()
> 
> gs1 = gridspec.GridSpec(2, 2)
> ax_list = [fig.add_subplot(ss) for ss in gs1]
> 
> fig.text (02, 0, "test", horizontalalignment='left',
>   verticalalignment='bottom', size=5)
> fig.text (0.5, 1, "01", horizontalalignment='left',
>   verticalalignment='top', size='x-small')
> 
> gs1.tight_layout(fig, rect=[0, 0.03, 1, 0.97]) # adjust rect parameter
> to make some room for figtext.
> 
> 
> Regards,
> 
> -JJ
> 
> 
> On Wed, Mar 28, 2012 at 9:17 PM, Neal Becker  wrote:
>> I just tried 1.1.1rc to see if it fixed the tight_layout for figtext.
>>
>> I have a semilogy plot, and add  some lines of text on the bottom (and top):
>>
>> plt.figtext (0, 0, res['carriers'].values, horizontalalignment='left',
>> verticalalignment='bottom', size=5)
>> plt.figtext (0.5, 1, self.pageno, horizontalalignment='left',
>> verticalalignment='top', size='x-small')
>> ##plt.tight_layout(pad=1.0)
>> plt.tight_layout()
>>
>> The text on the bottom is overprinting the x axis - the same as happened 
>> with the previous release.
>>
>>
>> 
--
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure
>> ___
>> Matplotlib-devel mailing list
>> Matplotlib-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
> 
> --
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> ___
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel



--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] 1.1.1rc RuntimeError: underlying C/C++ object has been deleted

2012-03-28 Thread Michael Droettboom
Can you provide more detail about how to reproduce this?

I can deduce you're using the Qt4Agg backend -- but running 
simple_plot.py, zooming around, and then closing the window does not 
seem to reproduce the error here.

What version of Qt/PyQt/PySide are you running.  What platform?

Mike

On 03/28/2012 08:34 AM, Neal Becker wrote:
> I'm getting these messages, which did not occur with 1.1:
>
> Traceback (most recent call last):
>File "/home/nbecker/.local/lib/python2.7/site-
> packages/matplotlib/backends/backend_qt4.py", line 151, in
>  lambda: self.close_event())
>File "/home/nbecker/.local/lib/python2.7/site-
> packages/matplotlib/backend_bases.py", line 1564, in close_event
>  self.callbacks.process(s, event)
> RuntimeError: underlying C/C++ object has been deleted
>
>
> --
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> ___
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] 1.1.1rc RuntimeError: underlying C/C++ object has been deleted

2012-03-28 Thread Neal Becker
qt-x11-4.8.0-7.fc16.x86_64
PyQt4-4.8.6-1.fc16.x86_64

But interestingly, I'm not actually using the display in this script.  I'm 
using 
pdfpages.

The basic outline is:
At the start:

from matplotlib.backends.backend_pdf import PdfPages
self.pdf = PdfPages(file_name)

Then at the start of each page I do:
self.prop = mpl.font_manager.FontProperties(size='xx-small')

self.fig = fig = plt.figure() 
self.ax = fig.add_subplot(111)
fig.subplots_adjust(bottom=0.2)
self.colors = itertools.cycle(['r','g','b','c','y','m','k']) 
self.markers = itertools.cycle(['o','s','v']) 

Then at the start of each plot on a page I do:

self.ax.semilogy (esno, [e for e in per], c=self.colors.next(), 
marker=self.markers.next(), label='iter=%s'%n_iter)

Finally, to finish each page:

plt.title (...)
plt.grid(which='major', linestyle='solid')
plt.grid(which='minor', linestyle='dashed')
plt.legend(prop=self.prop, loc='best')
self.ax.set_xlabel ('${E_s}/N_0$')
self.ax.set_ylabel ('per')
plt.figtext (0, 0, res['carriers'].values, horizontalalignment='left', 
verticalalignment='bottom', size=5)
self.pdf.savefig (self.fig)
plt.close()

Then when all pages are done:
self.pdf.close()

It looks like I'm getting one of these error messages for each page.


Michael Droettboom wrote:

> Can you provide more detail about how to reproduce this?
> 
> I can deduce you're using the Qt4Agg backend -- but running
> simple_plot.py, zooming around, and then closing the window does not
> seem to reproduce the error here.
> 
> What version of Qt/PyQt/PySide are you running.  What platform?
> 
> Mike
> 
> On 03/28/2012 08:34 AM, Neal Becker wrote:
>> I'm getting these messages, which did not occur with 1.1:
>>
>> Traceback (most recent call last):
>>File "/home/nbecker/.local/lib/python2.7/site-
>> packages/matplotlib/backends/backend_qt4.py", line 151, in
>>  lambda: self.close_event())
>>File "/home/nbecker/.local/lib/python2.7/site-
>> packages/matplotlib/backend_bases.py", line 1564, in close_event
>>  self.callbacks.process(s, event)
>> RuntimeError: underlying C/C++ object has been deleted
>>
>>
>> 
--
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure
>> ___
>> Matplotlib-devel mailing list
>> Matplotlib-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
> 
> 
> --
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure



--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] 1.1.1rc RuntimeError: underlying C/C++ object has been deleted

2012-03-28 Thread John Hunter
On Wed, Mar 28, 2012 at 8:57 AM, Neal Becker  wrote:

> qt-x11-4.8.0-7.fc16.x86_64
> PyQt4-4.8.6-1.fc16.x86_64
>
> But interestingly, I'm not actually using the display in this script.  I'm
> using
> pdfpages.


At the beginning of your script (before importing pylab/pyplot) you should
be doing

import matplotlib
matplotlib.use('pdf')

It looks like you are inadvertently importing the qt library in a headless
script run.

JDH
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] 1.1.1rc RuntimeError: underlying C/C++ object has been deleted

2012-03-28 Thread Neal Becker
John Hunter wrote:

> On Wed, Mar 28, 2012 at 8:57 AM, Neal Becker
>  wrote:
> 
>> qt-x11-4.8.0-7.fc16.x86_64
>> PyQt4-4.8.6-1.fc16.x86_64
>>
>> But interestingly, I'm not actually using the display in this script.  I'm
>> using
>> pdfpages.
> 
> 
> At the beginning of your script (before importing pylab/pyplot) you should
> be doing
> 
> import matplotlib
> matplotlib.use('pdf')
> 
> It looks like you are inadvertently importing the qt library in a headless
> script run.
> 
> JDH

Thanks, but should that cause a (scary looking) error?  Or is there a real 
problem?


--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] 1.1.1rc RuntimeError: underlying C/C++ object has been deleted

2012-03-28 Thread John Hunter
On Wed, Mar 28, 2012 at 1:22 PM, Neal Becker  wrote:

>
> > import matplotlib
> > matplotlib.use('pdf')
> >
> > It looks like you are inadvertently importing the qt library in a
> headless
> > script run.
> >
> > JDH
>
> Thanks, but should that cause a (scary looking) error?  Or is there a real
> problem?
>
>
> It's just a clean up error in the qt destructors I  think.  You are
basically in an unsupported use case: using a gui backend, but not raising
the figures with show, so our initialization code doesn't get run properly,
which means the clean up may not be properly configured.  Our work is hard
enough supporting all the GUI toolkits across multiple operating systems --
I don't know that we want to get into trying to support *unsupported* use
cases.

JDH
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] soliciting feedback on proposed user survey

2012-03-28 Thread Paul Ivanov
Hey everyone,

with 1.1.1 just around the corner, I thought it'd be nice to put
together an MPL user survey, similar to what Thomas Kluyver
organized for IPython last year [1].

Here's what I've got so far [2], and here's the response one gets
upon filling out the form:

-
Thanks for your feedback.

As promised, here are the details of how to do various things:

the official documentation is at: 
http://matplotlib.sourceforge.net/

to run the test suite:
python -c "import matplotlib; matplotlib.test()"

file bug reports and submit pull requests here: 
https://github.com/matplotlib/matplotlib

to post to the matplotlib-users list, subscribe here:
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-

with an additional link at the bottom to look at the summary of previous
respondents, which looks like [3].

How does this look to everyone? Any changes before I distribute
this more widely? (Preferably not just via list, but also add a
link to it on the main page, which is what IPython folks also did
for a while).

1. http://ipython.org/usersurvey2011.html
2. 
https://docs.google.com/spreadsheet/viewform?formkey=dHpQS25pcTZIRWdqX0pNckNSU01sMHc6MQ
3. 
https://docs.google.com/spreadsheet/viewanalytics?formkey=dHpQS25pcTZIRWdqX0pNckNSU01sMHc6MQ

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] soliciting feedback on proposed user survey

2012-03-28 Thread Paul Ivanov
Paul Ivanov, on 2012-03-28 17:22,  wrote:
> Hey everyone,
> 
> with 1.1.1 just around the corner, I thought it'd be nice to put
> together an MPL user survey, similar to what Thomas Kluyver
> organized for IPython last year [1].
> 
> Here's what I've got so far [2], and here's the response one gets
> upon filling out the form:
> 
> -
> Thanks for your feedback.
> 
> As promised, here are the details of how to do various things:
> 
> the official documentation is at: 
> http://matplotlib.sourceforge.net/
> 
> to run the test suite:
> python -c "import matplotlib; matplotlib.test()"
> 
> file bug reports and submit pull requests here: 
> https://github.com/matplotlib/matplotlib
> 
> to post to the matplotlib-users list, subscribe here:
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> -
> 
> with an additional link at the bottom to look at the summary of previous
> respondents, which looks like [3].
> 
> How does this look to everyone? Any changes before I distribute
> this more widely? (Preferably not just via list, but also add a
> link to it on the main page, which is what IPython folks also did
> for a while).
> 
> 1. http://ipython.org/usersurvey2011.html
> 2. 
> https://docs.google.com/spreadsheet/viewform?formkey=dHpQS25pcTZIRWdqX0pNckNSU01sMHc6MQ
> 3. 
> https://docs.google.com/spreadsheet/viewanalytics?formkey=dHpQS25pcTZIRWdqX0pNckNSU01sMHc6MQ

Me again, just decided to inline the survey text, so that
suggestions can be more readily made here, without having to
following links, etc.


matplotlib user survey 2012

Stand up and be counted, matplotlib developers want to hear from you! All
questions are optional, we look forward to your feedback.
━━━

What country are you from? []

How long have you been using matplotlib?

  • (*) about a month
  • ( ) < 6 months
  • ( ) about a year
  • ( ) 2 to 4 years
  • ( ) more than 4 years


What operating system do you run matplotlib on? (check all that apply)

  • [ ] *BSD (FreeBSD, NetBSD, OpenBSD, etc)
  • [ ] GNU/Linux (Ubuntu, Debian, Fedora, RHEL, OpenSUSE, Arch, Gentoo, etc)
  • [ ] Mac OS X
  • [ ] Windows
  • [ ] Other: []


What version of python do you use matplotlib on? (check all that apply)

  • [ ] 2.4
  • [ ] 2.5
  • [ ] 2.6
  • [ ] 2.7
  • [ ] 3.0
  • [ ] 3.1
  • [ ] 3.2


You use matplotlib for: (check all that apply)

  • [ ] Academic development (research, publication graphics, etc.)
  • [ ] Commercial development
  • [ ] Personal hobby / recreationally


You *primarily* use matplotlib for: (check all that apply)

  • ( ) Academic development (research, publication graphics, etc.)
  • ( ) Commercial development
  • ( ) Personal hobby / recreationally


How do you use matplotlib? 
[   ]
[   ]
[   ]

How frequently do you *RUN* code which uses matplotlib?

  • ( ) daily
  • ( ) a few times per week
  • ( ) a few times per month
  • ( ) less frequently


How frequently do you *WRITE* code which uses matplotlib?

  • ( ) daily
  • ( ) a few times per week
  • ( ) a few times per month
  • ( ) less frequently


For the matplotlib project, do you know how to ... (check all that apply,
you'll get all the answers after you hit the submit button)

  • [ ] locate and navigate the official documentation
  • [ ] run the test suite
  • [ ] file bug reports on GitHub
  • [ ] post to the matplotlib-users list
  • [ ] submit patches / pull requests


In the past year, have you... (check all that apply)

  • [ ] accessed the official documentation
  • [ ] run the test suite
  • [ ] filed a bug report on GitHub
  • [ ] posted to the matplotlib-users list
  • [ ] submitted a patch / pull request


How do you get matplotlib on your machine? (check all that apply)

  • [ ] compile and install directly from source (zip / tarball / git checkout)
  • [ ] use official packages provided by matplotlib team
  • [ ] use packages provided by my operating system (.deb, .rpm, ports, etc)
  • [ ] Enthought Python Distribution (EPD) 
http://enthought.com/products/epd.php
  • [ ] Python(X,Y) http://code.google.com/p/pythonxy/
  • [ ] Sage http://sagemath.org/
  • [ ] Other: []


What other plotting libraries do you use and why? 
[   ]
[   ]
[   ]

How would you like matplotlib to improve in the future? 
[   ]
[   ]
[