Re: [Matplotlib-users] toolbar

2010-03-21 Thread Philippe Crave
without the svn version, you can save both files.
edit figureoptions.py to modify the import:
#import matplotlib.backends.qt4_editor.formlayout as formlayout
import formlayout

then, you can attach the nice dialog box to a Event, something like that
works:

import matplotlib.pyplot as plt
import numpy as np
import figureoptions

t = np.arange(0, 1+0.01, 0.01)
y = np.sin(2*np.pi*t)

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(t, y, 'r-o')

def onclick(event):
figureoptions.figure_edit(ax)

cid = fig.canvas.mpl_connect('button_press_event', onclick)

plt.show()

click on the figure, you will get the dialog box. less cool than the button,
but not too bad.


2010/3/21 Peter Butterworth 

> Correction: '0.99.3rc1' does not include the qt4_editor code, so you
> do need to get the source files from svn.
>
> The feature is a nice addition to matplotlib..
>
>
> On Sun, Mar 21, 2010 at 1:53 AM, Gökhan Sever 
> wrote:
> >
> >
> > On Sat, Mar 20, 2010 at 7:43 PM,  wrote:
> >>
> >> I'm using the recent '0.99.3rc1' which does include the qt4_editor code.
> >
> >
> > If you have the qt4_editor code within your installation you are good to
> go
> > then. Just create a new plot while the Qt4Agg backend is pre-selected you
> > should have an additional icon on the existing navigation toolbar. From
> > there on you should see a window when you fire that icon.
> >
> > It is migrated from Pierre Raybout's spyderlib
> > (http://code.google.com/p/spyderlib/)
> >
> >
> >>
> >> Should the new toolbar just appear when you open a plot or is specific
> >> code needed to call it ?
> >>
> >>
> >> Le , Gökhan Sever  a écrit :
> >> >
> >> >
> >> > On Sat, Mar 20, 2010 at 6:06 PM, butterw butt...@gmail.com> wrote:
> >> >
> >> >
> >> >
> >> > Is there an minimal example file available showing how to activate
> this
> >> > new
> >> >
> >> > plot toolbar ?
> >> >
> >> >
> >> >
> >> > changing the backend to Qt4Agg apparently is not sufficient.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > You need to install matplotlib from the svn trunk.
> >> >
> >> > http://matplotlib.sourceforge.net/faq/installing_faq.html#install-svn
> >> >
> >> >
> >> > --
> >> > Gökhan
> >
> >
> > --
> > Gökhan
> >
>
>
> --
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] AssertionError without further description

2010-03-21 Thread Martin Bothe
Hello matplotlib-community,

I'm using matplotlib since a while, but have never had a real reason to
write to the mailing-list yet.
Furthermore I know, that the Cookbook at scipy.org is more or less outdated

Anyway, I tried the multicolored Line example at
http://www.scipy.org/Cookbook/Matplotlib/MulticoloredLine (at the bottom)
and found that I get an AssertionError, without further description or
exeption string.
The line producing the error is this one:

10. LC = LineCollection(segments, colors = colors)

How to get rid of this problem?
Is there an alternative way?

Thanks and greets!
Martin
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] AssertionError without further description

2010-03-21 Thread Ryan May
On Sun, Mar 21, 2010 at 6:17 AM, Martin Bothe
 wrote:
> Hello matplotlib-community,
>
> I'm using matplotlib since a while, but have never had a real reason to
> write to the mailing-list yet.
> Furthermore I know, that the Cookbook at scipy.org is more or less outdated
>
> Anyway, I tried the multicolored Line example at
> http://www.scipy.org/Cookbook/Matplotlib/MulticoloredLine (at the bottom)
> and found that I get an AssertionError, without further description or
> exeption string.
> The line producing the error is this one:
>
> 10. LC = LineCollection(segments, colors = colors)
>
>
>
> How to get rid of this problem?
> Is there an alternative way?

Can you copy and paste the actual error message and traceback? I run
the script here on SVN trunk and it works fine.

If you're looking for an update "cookbook", you can always look at the gallery:

http://matplotlib.sourceforge.net/gallery.html

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] AssertionError without further description

2010-03-21 Thread Martin Bothe
Hey Ryan,

thanks for your answer.
Ashamed I have to realize that the example works for me as well.

When I tried it the first time, I had no pc featuring both internet and a
matplotlib installation, so I had to copy everything manually.
It seems I skipped a line or whatever.

In the gallery, I can't find a multicolored line.
Thanks again, greetings
Martin

On Sun, Mar 21, 2010 at 5:59 PM, Ryan May  wrote:

> On Sun, Mar 21, 2010 at 6:17 AM, Martin Bothe
>  wrote:
> > Hello matplotlib-community,
> >
> > I'm using matplotlib since a while, but have never had a real reason to
> > write to the mailing-list yet.
> > Furthermore I know, that the Cookbook at scipy.org is more or less
> outdated
> >
> > Anyway, I tried the multicolored Line example at
> > http://www.scipy.org/Cookbook/Matplotlib/MulticoloredLine (at the
> bottom)
> > and found that I get an AssertionError, without further description or
> > exeption string.
> > The line producing the error is this one:
> >
> > 10. LC = LineCollection(segments, colors = colors)
> >
> >
> >
> > How to get rid of this problem?
> > Is there an alternative way?
>
> Can you copy and paste the actual error message and traceback? I run
> the script here on SVN trunk and it works fine.
>
> If you're looking for an update "cookbook", you can always look at the
> gallery:
>
> http://matplotlib.sourceforge.net/gallery.html
>
> Ryan
>
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
>
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] AssertionError without further description

2010-03-21 Thread Ryan May
On Sun, Mar 21, 2010 at 12:23 PM, Martin Bothe  wrote:
> Hey Ryan,
> thanks for your answer.
> Ashamed I have to realize that the example works for me as well.
> When I tried it the first time, I had no pc featuring both internet and a
> matplotlib installation, so I had to copy everything manually.
> It seems I skipped a line or whatever.
> In the gallery, I can't find a multicolored line.

That's because it wasn't there. :)  I've ported it to make better use
of matplotlib facilities that are now available and added it to SVN.
In general, however, the gallery is the best place to look because we
should be keeping it up to date with changes in the code.

I attached the modified script since it won't show up in the gallery
right away. I'd take a look, because it drastically simplifies the
colormapping.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma


multicolored_line.py
Description: Binary data
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] AssertionError without further description

2010-03-21 Thread Eric Firing
Ryan May wrote:
> On Sun, Mar 21, 2010 at 12:23 PM, Martin Bothe  wrote:
>> Hey Ryan,
>> thanks for your answer.
>> Ashamed I have to realize that the example works for me as well.
>> When I tried it the first time, I had no pc featuring both internet and a
>> matplotlib installation, so I had to copy everything manually.
>> It seems I skipped a line or whatever.
>> In the gallery, I can't find a multicolored line.
> 
> That's because it wasn't there. :)  I've ported it to make better use
> of matplotlib facilities that are now available and added it to SVN.
> In general, however, the gallery is the best place to look because we
> should be keeping it up to date with changes in the code.
> 
> I attached the modified script since it won't show up in the gallery
> right away. I'd take a look, because it drastically simplifies the
> colormapping.

Nice!

Would you also edit the cookbook, please?  You could just point to your 
new example; and maybe include a version with a more typical colormap 
and norm, giving a smooth gradation.

Thank you.

Eric

> 
> Ryan
> 
> 
> 
> 
> 
> --
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> 
> 
> 
> 
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] ValueError: x and y must have same first dimension

2010-03-21 Thread AG
Hi List

I cannot figure out how to satisfy this issue to resolve the ValueError: 
x and y must have same first dimension.


This is the relevant code:
[code]

for i in range( 0, time + 1 ):

outflow = constant * quantity

quantityChange = inflow - outflow

changeList.append( quantityChange )

print "%2d %9.2f %11.3f %11.3f %10.3f" % ( i, inflow, quantity, 
outflow, quantityChange )

quantity += quantityChange

   
 
# Plot on graph

x = np.arange( time )
y = np.arange( quantityChange )

plt.plot( x, y, label="rate of change" )
plt.ylabel( "Quantity" )
plt.xlabel( "Time" )
plt.show()


[/code]

I have picked up that neither a 'list' or an 'int' are iterable objects, 
but I am stymied by how I can successfully get the x and y axes to 
portray the data outputs.

Also, what does that error message mean?  That  the starting point must 
be 0 or of the same object type?  I haven't found a clear answer in the 
tutorial pages yet, but I will perservere.

TIA

AG

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Using colourmap from matplotlib

2010-03-21 Thread Friedrich Romstedt
2010/3/20 Ciarán Mooney :
> I am using PIL because I plan to plug in a Tkinter interface which can
> directly accept PIL image instances.

You can render matplotlib figures to PIL using following code:

figure.set_size_inches(float(shape[0]) / figure.dpi, float(shape[1]) /
figure.dpi)

canvas = matplotlib.backends.backend_agg.FigureCanvasAgg(figure)
canvas.draw()
image_string = canvas.tostring_rgb()

image = Image.fromstring("RGB", shape, image_string)

fwiw,
Friedrich

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ValueError: x and y must have same first dimension

2010-03-21 Thread Gökhan Sever
On Sun, Mar 21, 2010 at 1:57 PM, AG wrote:

> Hi List
>
> I cannot figure out how to satisfy this issue to resolve the ValueError:
> x and y must have same first dimension.
>
>
> This is the relevant code:
> [code]
>
> for i in range( 0, time + 1 ):
>
>outflow = constant * quantity
>
>quantityChange = inflow - outflow
>
>changeList.append( quantityChange )
>
>print "%2d %9.2f %11.3f %11.3f %10.3f" % ( i, inflow, quantity,
> outflow, quantityChange )
>
>quantity += quantityChange
>
>
>
> # Plot on graph
>
> x = np.arange( time )
> y = np.arange( quantityChange )
>
> plt.plot( x, y, label="rate of change" )
> plt.ylabel( "Quantity" )
> plt.xlabel( "Time" )
> plt.show()
>
>
> [/code]
>
> I have picked up that neither a 'list' or an 'int' are iterable objects,
> but I am stymied by how I can successfully get the x and y axes to
> portray the data outputs.
>
> Also, what does that error message mean?  That  the starting point must
> be 0 or of the same object type?  I haven't found a clear answer in the
> tutorial pages yet, but I will perservere.
>
> TIA
>
> AG
>
>
>
x and y must be in the same length otherwise you hit that error message.

try simply to see the failure:

plt.plot([1,2], [1,2,3])

Use len(x) or x.shape to see how many elements in the array and adjust your
code to make x and y has the same length before plotting.


-- 
Gökhan
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [SOLVED] Re: ValueError: x and y must have same first dimension

2010-03-21 Thread AG

Gökhan Sever wrote:



On Sun, Mar 21, 2010 at 1:57 PM, AG > wrote:


Hi List

I cannot figure out how to satisfy this issue to resolve the
ValueError:
x and y must have same first dimension.


This is the relevant code:
[code]

for i in range( 0, time + 1 ):

   outflow = constant * quantity

   quantityChange = inflow - outflow

   changeList.append( quantityChange )

   print "%2d %9.2f %11.3f %11.3f %10.3f" % ( i, inflow, quantity,
outflow, quantityChange )

   quantity += quantityChange



# Plot on graph

x = np.arange( time )
y = np.arange( quantityChange )

plt.plot( x, y, label="rate of change" )
plt.ylabel( "Quantity" )
plt.xlabel( "Time" )
plt.show()


[/code]

I have picked up that neither a 'list' or an 'int' are iterable
objects,
but I am stymied by how I can successfully get the x and y axes to
portray the data outputs.

Also, what does that error message mean?  That  the starting point
must
be 0 or of the same object type?  I haven't found a clear answer
in the
tutorial pages yet, but I will perservere.

TIA

AG



x and y must be in the same length otherwise you hit that error message.

try simply to see the failure:

plt.plot([1,2], [1,2,3])

Use len(x) or x.shape to see how many elements in the array and adjust 
your code to make x and y has the same length before plotting.



--
Gökhan


That was very helpful, thank you Gökhan.  Having played around with it a 
bit, I think I've got it fixed.


Thanks.

AG
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] AssertionError without further description

2010-03-21 Thread Ryan May
On Sun, Mar 21, 2010 at 1:36 PM, Eric Firing  wrote:
> Ryan May wrote:
>> That's because it wasn't there. :)  I've ported it to make better use
>> of matplotlib facilities that are now available and added it to SVN.
>> In general, however, the gallery is the best place to look because we
>> should be keeping it up to date with changes in the code.
>>
>> I attached the modified script since it won't show up in the gallery
>> right away. I'd take a look, because it drastically simplifies the
>> colormapping.
>
> Nice!
>
> Would you also edit the cookbook, please?  You could just point to your new
> example; and maybe include a version with a more typical colormap and norm,
> giving a smooth gradation.

There actually was an example there already showing the nice smooth
gradient of colors.  I've cleaned up that example and added that to
SVN as well. I kept the discrete example as it shows nicely the use of
listed colormaps and boundary norms, which aren't used in a lot of
examples.

I've updated the recipes on scipy.org to reflect our examples, as well
as putting a link to the gallery.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] 'import pylab' error

2010-03-21 Thread Scott Riccardelli
Hi,

Python crashes on one of my computers when I execute: *import pylab*
All I need to do is execute this one line of code and poof.
A dialog pops up stating that "python.exe has encountered a problem and
needs to close.
We are sorry for the inconvenience
I installed matplotlib version 0.99.1 using python xy.  However I
encountered this same
problem when I installed using the python 2.6.4 and
matplotlib-0.99.1.win32-py2.6 installers.

Running python using verbose output shows that a problem is encountered when
the statement
*import matplotlib.transforms # precompiled from
C:\Python26\lib\site-packages\matplotlib\transforms.pyc*
is reached.  This may be the culprit.

Thanks for any help,
Scott
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] mpl UML?

2010-03-21 Thread David Carmean

Has anyone seen/created any UML models/diagrams for Matplotlib?  

I'm currently doing so to help me understand how to use it in an 
application, but wondered if somebody has already built the wheel 
that I'm trying to invent.

One of the things I'm trying to figure out is whether I can build 
a graphic in "reverse order".  The standard M.O. seems to be to 
traverse a self-building tree by invoking convenience methods on 
each new child, Figure-->Subplot-->plot_date, etc.

What I'm looking to do is build from the bottom up, e.g. create a line 
or scatter plot instance *first*, then append that to the children of 
an existing Axes instance, which is in-turn appended to the childrend of 
a Figure instance.  

Thanks.


--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] mpl UML?

2010-03-21 Thread Ryan May
On Sun, Mar 21, 2010 at 3:35 PM, David Carmean  wrote:
>
> Has anyone seen/created any UML models/diagrams for Matplotlib?
>
> I'm currently doing so to help me understand how to use it in an
> application, but wondered if somebody has already built the wheel
> that I'm trying to invent.
>
> One of the things I'm trying to figure out is whether I can build
> a graphic in "reverse order".  The standard M.O. seems to be to
> traverse a self-building tree by invoking convenience methods on
> each new child, Figure-->Subplot-->plot_date, etc.
>
> What I'm looking to do is build from the bottom up, e.g. create a line
> or scatter plot instance *first*, then append that to the children of
> an existing Axes instance, which is in-turn appended to the childrend of
> a Figure instance.

Certainly things like lines, collections can be added to existing axes
(and don't need one around to be created).  This is actually what's
used under the hood. You *should* also be able to create an axes
object and then set its figure, but I've never personally done it.

What you really want to look at are a lot of Axes methods:
set_figure()
add_artists()
add_collection()
add_line()

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users