[matplotlib-devel] Enhancement to matplotlib's PyQt4 backend

2009-04-28 Thread Pierre Raybaut
Hi all,

I would like to contribute to matplotlib with this enhancement for the
PyQt4 backend: the idea is to add a toolbar button to configure figure
options (axes, curves, ...).

It's based on a tiny module called formlayout to generate PyQt4 form
dialog automatically.

Some screenshots:
http://code.google.com/p/formlayout/

So, if you're interested (all the following is GPL2):

*matplotlib patch*

In FigureManagerQT.__init__, added:
self.canvas.axes = self.canvas.figure.add_subplot(111)

In NavigationToolbar2QT._init_toolbar, added:
a = self.addAction(self._icon("customize.png"), 'Customize',
self.edit_parameters)
a.setToolTip('Edit curves line and axes parameters')

Added the following method in NavigationToolbar2QT:
def edit_parameters(self):
from figureoptions import figure_edit
figure_edit(self.canvas, self)

*additionnal modules and data*

formlayout.py (http://code.google.com/p/formlayout/)
figureoptions.py (http://code.google.com/p/PyQtShell/)
customize.png (http://code.google.com/p/PyQtShell/)


cheers,
Pierre

--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Enhancement to matplotlib's PyQt4 backend

2009-04-28 Thread John Hunter
On Tue, Apr 28, 2009 at 8:18 AM, Pierre Raybaut wrote:

> Hi all,
>
> I would like to contribute to matplotlib with this enhancement for the
> PyQt4 backend: the idea is to add a toolbar button to configure figure
> options (axes, curves, ...).
>
> It's based on a tiny module called formlayout to generate PyQt4 form
> dialog automatically.
>
> Some screenshots:
> http://code.google.com/p/formlayout/
>
> So, if you're interested (all the following is GPL2):
>
> *matplotlib patch*
>
> In FigureManagerQT.__init__, added:
> self.canvas.axes = self.canvas.figure.add_subplot(111)
>
> In NavigationToolbar2QT._init_toolbar, added:
> a = self.addAction(self._icon("customize.png"), 'Customize',
> self.edit_parameters)
> a.setToolTip('Edit curves line and axes parameters')
>
> Added the following method in NavigationToolbar2QT:
> def edit_parameters(self):
>from figureoptions import figure_edit
>figure_edit(self.canvas, self)
>
> *additionnal modules and data*
>
> formlayout.py (http://code.google.com/p/formlayout/)
> figureoptions.py (http://code.google.com/p/PyQtShell/)
> customize.png (http://code.google.com/p/PyQtShell/)



Hi Pierre -- this looks very nice (the last link is broken though , I get a
404 error).  We would be happy to include this in matplotlib or as a
toolkit.  To contribute it to to mpl,  the license needs to be matplotlib
compatible (
http://matplotlib.sourceforge.net/devel/coding_guide.html#licenses) but we
have more licensing flexibility in a toolkit, though we prefer to keep
everything BSD compatible where possible.   And of course you would need to
agree to maintain it :-) but I think many users would appreciate a GUI plot
configuration dialog.

JDH
--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] grid bug

2009-04-28 Thread Olivier Feys




Hi,

I found a bug with the grid after passing by a log scale.
Here is the sample code reproducing the bug : 


from pylab import *
  
plot(range(50),range(50))
draw()
gca().set_yscale('log')
draw()
gca().xaxis.grid()
draw()
gca().set_yscale('linear')
draw()
show()


The grid on the xaxis
disappears after setting back the yaxis to linear.
Please let me know if this is
the right place for posting this kind of message. If not, where can I
do that ?

Thanks 

Olivier




--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] grid bug

2009-04-28 Thread John Hunter
On Tue, Apr 28, 2009 at 3:18 AM, Olivier Feys wrote:

>  Hi,
>
> I found a bug with the grid after passing by a log scale.
> Here is the sample code reproducing the bug :
>
>  from pylab import *
>
> plot(range(50),range(50))
> draw()
> gca().set_yscale('log')
> draw()
> gca().xaxis.grid()
> draw()
> gca().set_yscale('linear')
> draw()
> show()
>
>
> The grid on the xaxis disappears after setting back the yaxis to linear.
> Please let me know i
>


I am not seeing this with svn matplotlib -- what version are you using?


http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#report-a-problem

http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#obtaining-matplotlib-version

JDH
--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] grid bug

2009-04-28 Thread Olivier Feys




0.98.5.2

John Hunter wrote:

  
  On Tue, Apr 28, 2009 at 3:18 AM, Olivier
Feys 
wrote:
  
Hi,

I found a bug with the grid after passing by a log scale.
Here is the sample code reproducing the bug : 


from pylab import *
  
plot(range(50),range(50))
draw()
gca().set_yscale('log')
draw()
gca().xaxis.grid()
draw()
gca().set_yscale('linear')
draw()
show()


The grid on the xaxis
disappears after setting back the yaxis to linear.
Please let me know i
  
  
  
  
I am not seeing this with svn matplotlib -- what version are you using?
  
  http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#report-a-problem
  http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#obtaining-matplotlib-version
  
JDH





--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] grid bug

2009-04-28 Thread John Hunter
On Tue, Apr 28, 2009 at 10:59 AM, Olivier Feys wrote:

>  0.98.5.2
>


I also am not seeing it on the 0.98 branch, so the good news is that if we
can ever get this release out as planned it should be fixed on the next
release.  Or if you are happy with svn and a compiler, you can upgrade from
svn

  http://matplotlib.sourceforge.net/faq/installing_faq.html#install-svn

JDH
--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Enhancement to matplotlib's PyQt4 backend

2009-04-28 Thread Pierre Raybaut
2009/4/28 John Hunter :
>
>
> On Tue, Apr 28, 2009 at 8:18 AM, Pierre Raybaut 
> wrote:
>>
>> Hi all,
>>
>> I would like to contribute to matplotlib with this enhancement for the
>> PyQt4 backend: the idea is to add a toolbar button to configure figure
>> options (axes, curves, ...).
>>
>> It's based on a tiny module called formlayout to generate PyQt4 form
>> dialog automatically.
>>
>> Some screenshots:
>> http://code.google.com/p/formlayout/
>>
>> So, if you're interested (all the following is GPL2):
>>
>> *matplotlib patch*
>>
>> In FigureManagerQT.__init__, added:
>> self.canvas.axes = self.canvas.figure.add_subplot(111)
>>
>> In NavigationToolbar2QT._init_toolbar, added:
>> a = self.addAction(self._icon("customize.png"), 'Customize',
>> self.edit_parameters)
>> a.setToolTip('Edit curves line and axes parameters')
>>
>> Added the following method in NavigationToolbar2QT:
>> def edit_parameters(self):
>>    from figureoptions import figure_edit
>>    figure_edit(self.canvas, self)
>>
>> *additionnal modules and data*
>>
>> formlayout.py (http://code.google.com/p/formlayout/)
>> figureoptions.py (http://code.google.com/p/PyQtShell/)
>> customize.png (http://code.google.com/p/PyQtShell/)
>
> Hi Pierre -- this looks very nice (the last link is broken though , I get a
> 404 error).  We would be happy to include this in matplotlib or as a

Here is the last link:
http://code.google.com/p/pyqtshell/

> toolkit.  To contribute it to to mpl,  the license needs to be matplotlib
> compatible
> (http://matplotlib.sourceforge.net/devel/coding_guide.html#licenses) but we
> have more licensing flexibility in a toolkit, though we prefer to keep
> everything BSD compatible where possible.   And of course you would need to
> agree to maintain it :-) but I think many users would appreciate a GUI plot
> configuration dialog.

I was not aware of this license restriction in matplotlib... I fully
understand the motivation, of course, but still: I wrote all this on
my free time which means no PyQt4 commercial license, so it can't be
anything but GPL. Sorry...

Pierre

>
> JDH
>

--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Enhancement to matplotlib's PyQt4 backend

2009-04-28 Thread Darren Dale
On Tue, Apr 28, 2009 at 12:19 PM, Pierre Raybaut wrote:

> 2009/4/28 John Hunter :
> >
> >
> > On Tue, Apr 28, 2009 at 8:18 AM, Pierre Raybaut 
> > wrote:
> >>
> >> Hi all,
> >>
> >> I would like to contribute to matplotlib with this enhancement for the
> >> PyQt4 backend: the idea is to add a toolbar button to configure figure
> >> options (axes, curves, ...).
> >>
> >> It's based on a tiny module called formlayout to generate PyQt4 form
> >> dialog automatically.
> >>
> >> Some screenshots:
> >> http://code.google.com/p/formlayout/
> >>
> >> So, if you're interested (all the following is GPL2):
> >>
> >> *matplotlib patch*
> >>
> >> In FigureManagerQT.__init__, added:
> >> self.canvas.axes = self.canvas.figure.add_subplot(111)
> >>
> >> In NavigationToolbar2QT._init_toolbar, added:
> >> a = self.addAction(self._icon("customize.png"), 'Customize',
> >> self.edit_parameters)
> >> a.setToolTip('Edit curves line and axes parameters')
> >>
> >> Added the following method in NavigationToolbar2QT:
> >> def edit_parameters(self):
> >>from figureoptions import figure_edit
> >>figure_edit(self.canvas, self)
> >>
> >> *additionnal modules and data*
> >>
> >> formlayout.py (http://code.google.com/p/formlayout/)
> >> figureoptions.py (http://code.google.com/p/PyQtShell/)
> >> customize.png (http://code.google.com/p/PyQtShell/)
> >
> > Hi Pierre -- this looks very nice (the last link is broken though , I get
> a
> > 404 error).  We would be happy to include this in matplotlib or as a
>
> Here is the last link:
> http://code.google.com/p/pyqtshell/
>
> > toolkit.  To contribute it to to mpl,  the license needs to be matplotlib
> > compatible
> > (http://matplotlib.sourceforge.net/devel/coding_guide.html#licenses) but
> we
> > have more licensing flexibility in a toolkit, though we prefer to keep
> > everything BSD compatible where possible.   And of course you would need
> to
> > agree to maintain it :-) but I think many users would appreciate a GUI
> plot
> > configuration dialog.
>
> I was not aware of this license restriction in matplotlib... I fully
> understand the motivation, of course, but still: I wrote all this on
> my free time which means no PyQt4 commercial license, so it can't be
> anything but GPL. Sorry...
>

I think you have overlooked a subtlety of PyQt4's license. The author of
PyQt4 wrote on the enthought-dev mailing list:

"PyQt is GPL but has exceptions that allow it to be used with BSD code -
hence it's Ok for TraitsBackendQt to be BSD.

However, the exception imposes additional conditions which, to all intents
and purposes, infects the code with the GPL. To be fair to people that
should be made clear in any text.

It's still a good idea for TraitsBackendQt to use a BSD license because it
allows commercial (ie. non-GPL) users to use it without problems."

Darren
--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Enhancement to matplotlib's PyQt4 backend

2009-04-28 Thread Dave Peterson

Darren Dale wrote:
On Tue, Apr 28, 2009 at 12:19 PM, Pierre Raybaut > wrote:


2009/4/28 John Hunter mailto:jdh2...@gmail.com>>:
>
>
> On Tue, Apr 28, 2009 at 8:18 AM, Pierre Raybaut
mailto:cont...@pythonxy.com>>
> wrote:
>>
>> Hi all,
>>
>> I would like to contribute to matplotlib with this enhancement
for the
>> PyQt4 backend: the idea is to add a toolbar button to configure
figure
>> options (axes, curves, ...).
>>
>> It's based on a tiny module called formlayout to generate PyQt4
form
>> dialog automatically.
>>
>> Some screenshots:
>> http://code.google.com/p/formlayout/
>>
>> So, if you're interested (all the following is GPL2):
>>
>> *matplotlib patch*
>>
>> In FigureManagerQT.__init__, added:
>> self.canvas.axes = self.canvas.figure.add_subplot(111)
>>
>> In NavigationToolbar2QT._init_toolbar, added:
>> a = self.addAction(self._icon("customize.png"), 'Customize',
>> self.edit_parameters)
>> a.setToolTip('Edit curves line and axes parameters')
>>
>> Added the following method in NavigationToolbar2QT:
>> def edit_parameters(self):
>>from figureoptions import figure_edit
>>figure_edit(self.canvas, self)
>>
>> *additionnal modules and data*
>>
>> formlayout.py (http://code.google.com/p/formlayout/)
>> figureoptions.py (http://code.google.com/p/PyQtShell/)
>> customize.png (http://code.google.com/p/PyQtShell/)
>
> Hi Pierre -- this looks very nice (the last link is broken
though , I get a
> 404 error).  We would be happy to include this in matplotlib or as a

Here is the last link:
http://code.google.com/p/pyqtshell/

> toolkit.  To contribute it to to mpl,  the license needs to be
matplotlib
> compatible
>
(http://matplotlib.sourceforge.net/devel/coding_guide.html#licenses)
but we
> have more licensing flexibility in a toolkit, though we prefer
to keep
> everything BSD compatible where possible.   And of course you
would need to
> agree to maintain it :-) but I think many users would appreciate
a GUI plot
> configuration dialog.

I was not aware of this license restriction in matplotlib... I fully
understand the motivation, of course, but still: I wrote all this on
my free time which means no PyQt4 commercial license, so it can't be
anything but GPL. Sorry...


I think you have overlooked a subtlety of PyQt4's license. The author 
of PyQt4 wrote on the enthought-dev mailing list:


"PyQt is GPL but has exceptions that allow it to be used with BSD code -
hence it's Ok for TraitsBackendQt to be BSD.

However, the exception imposes additional conditions which, to all intents
and purposes, infects the code with the GPL. To be fair to people that
should be made clear in any text.

It's still a good idea for TraitsBackendQt to use a BSD license because it
allows commercial (ie. non-GPL) users to use it without problems."

Darren


I think it might be worth contacting the PyQt folks (Phil Thompson) 
about this.  I think there might be some differences here because Phil 
was the author of TraitsBackendQt and thus his efforts didn't quite fall 
under the "develop under a free license, your results needs to be GPL" 
clause Qt/PyQt have in their licensing.


-- Dave

--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Problem saving to eps with usetex=True

2009-04-28 Thread Jae-Joon Lee
This patch is now committed to the trunk (r7068).

-JJ


On Sat, Apr 25, 2009 at 8:29 AM, Ken Schutte  wrote:
> Yeah, that seems to work!  thanks a lot,
> Ken
>
> On Fri, Apr 24, 2009 at 5:21 PM, Jae-Joon Lee  wrote:
>> ps backend, when usetex=True, uses latex with psfrag package to
>> generate the output (with some extra steps).
>> It seems that the bounding box information is not correctly recovered
>> during this process.
>> I first thought that it would be quite difficult to get this correct,
>> however the attached (relatively simple) patch seems to work fine.
>>
>> Ken, can you try the patch and see if it works?
>>
>> -JJ
>>
>>
>>
>>
>> On Thu, Apr 23, 2009 at 2:25 PM, Ken Schutte  wrote:
>>> I've been trying to track down some strange behavior I was getting,
>>> and I think narrowed it down to some code that I'll paste below.
>>>
>>> I'm trying to write to .eps files, and when I have usetex=True,
>>> something is screwed up with the padding on the left, and eventually
>>> the whole image is just white.
>>>
>>> If I run this script, the 'testA-*.eps' look good, but 'testB-*' does
>>> not.  The same problem happens even if I remove the ticklabels.
>>>
>>> Any tips would be appreciated.
>>> thanks,
>>> Ken
>>>
>>>
>>>
>>> 
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> from matplotlib import rc
>>>
>>> fig = plt.figure()
>>> ax = fig.add_axes([0,0,1,1],frameon=False)
>>>
>>> X = np.tile(np.arange(500),(10,1))  # (10,500) shape
>>>
>>> ax.imshow(X,interpolation='nearest',aspect='auto')
>>>
>>> def go(name):
>>>
>>>    for d in (1,2,3,4):
>>>
>>>        w = d*5
>>>        h = d
>>>
>>>        fig.set_size_inches(w,h)
>>>        fig.savefig("%s-%d.eps" % (name,d))
>>>
>>> rc('text', usetex=False)
>>> go("testA")
>>>
>>> rc('text', usetex=True)
>>> go("testB")
>>>
>>> --
>>> Crystal Reports - New Free Runtime and 30 Day Trial
>>> Check out the new simplified licensign option that enables unlimited
>>> royalty-free distribution of the report engine for externally facing
>>> server and web deployment.
>>> http://p.sf.net/sfu/businessobjects
>>> ___
>>> Matplotlib-devel mailing list
>>> Matplotlib-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>>>
>>
>

--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] backend_cairo.py clipping, bug in SVN

2009-04-28 Thread Michiel de Hoon

Hi everybody,

I believe a bug was introduced in revision 7002 of backend_cairo.py.
This code, in two places, now calls RendererCairo.convert_path with two 
arguments (ctx and tpath), whereas RendererCairo.convert_path expects three 
arguments. In one other place, RendererCairo.convert_path is called (correctly) 
with three arguments. One example of the code containing the bug is

tpath, affine = clippath.get_transformed_path_and_affine()
ctx.new_path()
affine = affine + Affine2D().scale(1.0, -1.0).translate(0.0, self.height)
tpath = affine.transform_path(tpath)
RendererCairo.convert_path(ctx, tpath)

Before this revision, the corresponding code was 

tpath, affine = path.get_transformed_path_and_affine()
ctx.new_path()
affine = affine + Affine2D().scale(1.0, -1.0).translate(0.0, 
self.renderer.height)
RendererCairo.convert_path(ctx, path, affine)

RendererCairo.convert_path is defined as

   @staticmethod
def convert_path(ctx, path, transform):

so with three arguments. Either the calls to convert_path are incorrect, or 
convert_path should be updated to handle two arguments.

--Michiel


  

--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel