[Matplotlib-users] confused about behavior inside and outside ipython

2010-10-06 Thread Collin Day
I have googled around and looked through the documents, but I can't
seem to find a description of the difference between running a script
inside and outside ipython (using ipython --pylab).  For example, I
tried doing the following in a script and made it executable.

#!/usr/bin/python

from __future__ import print_function
import matplotlib.pyplot as plt

for a in xrange(0,2):
print(a)
plt.plot([1,2,3,4])
plt.show()


In ipython, it just prints 0 and 1 and shows one figure then stops.
Outside ipython, for example just running from the command line, it
prints 0, shows a plot, and stops to wait for me to close the plot.
Then it prints one and shows a second plot (which is the behavior I am
looking for).

My question is how to I get the script to behave the same (as if I ran
it fro the command line) both inside and outside ipython?  If it isn't
possible directly, is there a way to pause execution in ipython to wait
until I close the plot before showing the next?


Thanks!

-C

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem with set_yticklabels

2010-10-06 Thread Jae-Joon Lee
With the current svn, the code works as expected.
So, I guess this is an issue that has been fixed.

Can you try something like below and see if this works?

   for tck in ax2.get_yticklabels():
   tck.set_fontsize(34)

Regards,

-JJ


On Wed, Oct 6, 2010 at 9:50 AM, Michael Lenander  wrote:
>
> I'm making a plot with two y axes.  When I  resize the font on the tick
> labels for the second axis, nothing happens. The same code however works
> fine for the first set of axes.
>
>    fig = figure()
>    ax1 = fig.add_subplot(111)
>    plot(bias,gamma1,'k.',markersize=mrkrsize)
>    ax1.set_ylim([0,10])
>    ax1.set_yticks([0,5,10])
>    ax1.set_yticklabels([0,5,10],fontsize=34) #Correctly sets tick label
> font size
>
>    ax2 = ax1.twinx()
>    plot(bias,f,'k.',markersize=mrkrsize)
>    ax2.set_yticks([0,-2,-4,-6])
>    ax2.set_yticklabels([0,-2,-4,-6],fontsize=34) #Remains default size, no
> error message
>
> As far as I can tell this really should work, unless there is something
> about twinx I don't understand. Any insight would be appreciated.
> --
> View this message in context: 
> http://old.nabble.com/Problem-with-set_yticklabels-tp29892687p29892687.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Issue with Redrawing a Line (numpy.ndarray, set_ydata, and draw)

2010-10-06 Thread Benjamin Root
On Wed, Oct 6, 2010 at 7:31 PM, Michael Cracraft  wrote:

> You are correct about the version.  I was just working with the version
> installed on Fedora 13, and the recache works.  Looks like a working
> solution for now.
>
> Thanks,
> Michael
>
>
Just as a side note because 'tis the season for Linux upgrades... It looks
like Jef Spaleta has packaged the version 1.0 of mpl for the upcoming Fedora
14 release (early Nov.).  However, Ubuntu 10.10 (Maverick Meerkat) will be
released in a few days with version 0.99.3.  Is this because Ubuntu
typically follows whatever is in the Debian repos?

Ben Root
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Scatter Plot with different colors

2010-10-06 Thread Jae-Joon Lee
On Tue, Oct 5, 2010 at 11:07 PM, Alessio Civ  wrote:
>
> Hi,
>
> I'm trying to make a scatter plot of 2 variables using a thirds as filter to
> have different colors.
>
> Let's say I have those data:
>
> x=1,2,3,4
> y=2,3,4,5
> z=0,1,0,1
>
> Then I want the values of x and y corresponding to those of z=0 to be of a
> color and those corresponding to z=1 to be of another color.
>
> This is the code I manage to do until know:
>
>
> import xlrd
> import numpy as np
> import matplotlib.pyplot as plt
>
> wb = xlrd.open_workbook('GBL2009.xls')
> sh = wb.sheet_by_index(0)
>
> def column_pos():
>    first_row=sh.row_values(0)
>    net_p=""
>    for i in first_row:
>        if i=='net_price':
>            net_p=first_row.index(i) #In gets the column position
>    for i in first_row:
>        if i=='material':
>            mat_p=first_row.index(i) #In gets the column position
>    for i in first_row:
>        if i=='qty':
>            qty_p=first_row.index(i) #In gets the column position
>    print net_p,  mat_p,  qty_p
>    #filtering(net_p, mat_p, qty_p)
>    test(net_p, mat_p, qty_p)
>
>
> def test(net_p, mat_p, qty_p):
>    list=[]
>    for rownum in range(sh.nrows):
>        if sh.cell(rownum,mat_p).value in (96433890,  96433886):
>            list.append(sh.row_values(rownum))
>
>    x=[]
>    y=[]
>    z=[]
>    for i in list:
>        x.append(i[qty_p])
>        y.append(i[net_p])
>        z.append(i[mat_p])
>
>    fig = plt.figure(1, figsize=(5.5,5.5))
>    axScatter = plt.subplot(111)
>
>    colors = ('r', 'g', 'b', 'k')
>    for c in colors:
>        axScatter.scatter(x, y,  c=c,  marker='s')
>
>    plt.show()
>

So, what is your problem?
If you want to post a code, please post a complete (but simple!) code.

If you want to map values of z to colors, a simple solution would be
to use dict.

z = [0,1,0,1]
color_map = {0:"r", 1:"g"}
z_as_colors = map(color_map.get, z)

scatter supports colormap but it may not very useful for your case.

Regards,

-JJ

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib server side with pdf backend

2010-10-06 Thread Jae-Joon Lee
The pdf backend rely on the "tell" method of a given file object,
which (I think) is not supported by stdout.
As a workaround, you may use StringIO.


from cStringIO import StringIO
outs = StringIO()
plt.savefig(outs, format='pdf')
print os.getvalue()

Regards,

-JJ

On Fri, Oct 1, 2010 at 8:59 PM, damiano michael
 wrote:
>  hi !
>
> i would like to write a server side python script that generate .pdf
> documents.
>
> for the moment i have Python 2.7 installed server side
> and matplolib installed server side too.
>
> A simple script that create a simple plot and generate a .png picture
> works.
>
> this is the script i use :
>
> #---
>
> # to access standard output :
>
> import sys
>
>
>
> # select a non-GUI backend :
>
> import matplotlib
>
> matplotlib.use('Agg')
> #matplotlib.use("cairo.pdf")
>
> #matplotlib.use('PDF')
>
>
>
>
> # import plotting module :
>
> import matplotlib.pyplot as plt
>
>
>
> # generate the plot :
>
> plt.plot([1,2,3,2,3,4])
>
>
> # print the content type (what's the data type)
>
> # the new line is embedded, using '\n' notation :
> print "Content-Type: image/png\n"
> # print "Content-Type: image/PDF\n"
> # print "Content-type: application/pdf"
>
>
>
> # output directly to webserver, as a png file
>  :
> plt.savefig(sys.stdout, format='png')
>
>
> # plt.savefig(sys.stdout, format='PDF')
>
>
>
> # plt.savefig( "test.pdf", format='pdf'  )
>
> #---
>
> I am wondering how to do the same thing but with sending a pdf file
> instead of
> a png picture. (the # are for all the things i tried)
>
> Does someone know ?
>
> thanks.
>
> jean-claude
>
>
>
> --
> Virtualization is moving to the mainstream and overtaking non-virtualized
> environment for deploying applications. Does it make network security
> easier or more difficult to achieve? Read this whitepaper to separate the
> two and get a better understanding.
> http://p.sf.net/sfu/hp-phase2-d2d
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Issue with Redrawing a Line (numpy.ndarray, set_ydata, and draw)

2010-10-06 Thread Michael Cracraft
You are correct about the version.  I was just working with the version
installed on Fedora 13, and the recache works.  Looks like a working
solution for now.

Thanks,
Michael


On Wed, Oct 6, 2010 at 8:18 PM, Jae-Joon Lee  wrote:

> I believe that you're using older version of mpl (<1.0) and this is a
> known issues, which has been fixed.
>
>
> http://sourceforge.net/tracker/?func=detail&aid=2917758&group_id=80706&atid=560720
>
> Try to add
>
> L1.recache()
>
> after set_ydata.
>
> Regards,
>
> -JJ
>
>
>
> On Thu, Oct 7, 2010 at 3:06 AM, Michael Cracraft
>  wrote:
> > I have a code that continuously modifies a numpy.ndarray variable.  Then,
> I
> > use set_ydata on the matplotlib.lines.Line2D object to the same ndarray
> > variable.  Then, I call fig.canvas.draw() to redraw the figure, where fig
> is
> > Figure object.
> >
> > However, the line on the graph never changes.  I print a few entries to
> the
> > console to make sure that the variable is changing.
> >
> > It seems like the only way I can get the line to update is to create a
> > completely new ndarray, update that variable with the new values and use
> > set_ydata on my line object.  Then, the redraw works.  Other things that
> I
> > tried that didn't seem to work were:
> >
> > L1.set_ydata(x[:])
> > L1.set_ydata(x.tolist())
> > L1.set_ydata(list(x))
> >
> >
> > where L1 is my line object, and x is my ndarray.  To make it redraw I
> have
> > to do something like this.
> >
> > xnew = numpy.zeros(numpy.size(x,0))
> > for k in range(numpy.size(x,0)):
> >  xnew[k] = x[k]
> > L1.set_ydata(xnew)
> > fig.canvas.draw()
> >
> > Is there some switch I can set to force a redraw of the elements?  I feel
> > like I am missing something fundamental.
> >
> > Thanks,
> > Michael
> >
> > --
> > _
> >
> >
> --
> > Beautiful is writing same markup. Internet Explorer 9 supports
> > standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> > Spend less time writing and  rewriting code and more time creating great
> > experiences on the web. Be a part of the beta today.
> > http://p.sf.net/sfu/beautyoftheweb
> > ___
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
>



-- 
_
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Issue with Redrawing a Line (numpy.ndarray, set_ydata, and draw)

2010-10-06 Thread Michael Cracraft
I am running python 2.6.4 and matplotlib 0.99.1.1.  I was using the TkAgg
backend with my original problem, but I tried GTKAgg with the same result.
Here are two sample codes.  One works and the other does not.

This one works ...

plt.ion()

x = np.arange(0,2*np.pi,0.01)
y = np.sin(x)
line, = plt.plot(x,y)
for i in np.arange(1,200):
y = np.sin(x + i/10.0)
line.set_ydata(y)
plt.draw()

This one does not ...

plt.ion()

x = np.arange(0,2*np.pi,0.01)
y = np.sin(x)
line, = plt.plot(x,y)
for i in np.arange(1,200):
for k in range(len(x)):
y[k] = np.sin(x[k] + i/10.0)
line.set_ydata(y)
plt.draw()

The only real difference is that I do not get a new ndarray instance in the
second one.  My guess was that there was something to do with the object
being the same instance as before causing some issue when I updated the
ydata.



On Wed, Oct 6, 2010 at 7:56 PM, Benjamin Root  wrote:

> On Wed, Oct 6, 2010 at 1:06 PM, Michael Cracraft <
> michael.cracr...@gmail.com> wrote:
>
>> I have a code that continuously modifies a numpy.ndarray variable.  Then,
>> I use set_ydata on the matplotlib.lines.Line2D object to the same ndarray
>> variable.  Then, I call fig.canvas.draw() to redraw the figure, where fig is
>> Figure object.
>>
>> However, the line on the graph never changes.  I print a few entries to
>> the console to make sure that the variable is changing.
>>
>> It seems like the only way I can get the line to update is to create a
>> completely new ndarray, update that variable with the new values and use
>> set_ydata on my line object.  Then, the redraw works.  Other things that I
>> tried that didn't seem to work were:
>>
>> L1.set_ydata(x[:])
>> L1.set_ydata(x.tolist())
>> L1.set_ydata(list(x))
>>
>>
>> where L1 is my line object, and x is my ndarray.  To make it redraw I have
>> to do something like this.
>>
>> xnew = numpy.zeros(numpy.size(x,0))
>> for k in range(numpy.size(x,0)):
>>  xnew[k] = x[k]
>> L1.set_ydata(xnew)
>> fig.canvas.draw()
>>
>> Is there some switch I can set to force a redraw of the elements?  I feel
>> like I am missing something fundamental.
>>
>> Thanks,
>> Michael
>>
>>
> Michael,
>
> Which version of matplotlib are you using?  Which backend are you using?
> Also, could you include a small script or two that demonstrate the problem?
> This way, we can poke around with it and see what is up.
>
> Ben Root
>
>


-- 
_
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Issue with Redrawing a Line (numpy.ndarray, set_ydata, and draw)

2010-10-06 Thread Jae-Joon Lee
I believe that you're using older version of mpl (<1.0) and this is a
known issues, which has been fixed.

http://sourceforge.net/tracker/?func=detail&aid=2917758&group_id=80706&atid=560720

Try to add

L1.recache()

after set_ydata.

Regards,

-JJ



On Thu, Oct 7, 2010 at 3:06 AM, Michael Cracraft
 wrote:
> I have a code that continuously modifies a numpy.ndarray variable.  Then, I
> use set_ydata on the matplotlib.lines.Line2D object to the same ndarray
> variable.  Then, I call fig.canvas.draw() to redraw the figure, where fig is
> Figure object.
>
> However, the line on the graph never changes.  I print a few entries to the
> console to make sure that the variable is changing.
>
> It seems like the only way I can get the line to update is to create a
> completely new ndarray, update that variable with the new values and use
> set_ydata on my line object.  Then, the redraw works.  Other things that I
> tried that didn't seem to work were:
>
> L1.set_ydata(x[:])
> L1.set_ydata(x.tolist())
> L1.set_ydata(list(x))
>
>
> where L1 is my line object, and x is my ndarray.  To make it redraw I have
> to do something like this.
>
> xnew = numpy.zeros(numpy.size(x,0))
> for k in range(numpy.size(x,0)):
>  xnew[k] = x[k]
> L1.set_ydata(xnew)
> fig.canvas.draw()
>
> Is there some switch I can set to force a redraw of the elements?  I feel
> like I am missing something fundamental.
>
> Thanks,
> Michael
>
> --
> _
>
> --
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Issue with Redrawing a Line (numpy.ndarray, set_ydata, and draw)

2010-10-06 Thread Benjamin Root
On Wed, Oct 6, 2010 at 1:06 PM, Michael Cracraft  wrote:

> I have a code that continuously modifies a numpy.ndarray variable.  Then, I
> use set_ydata on the matplotlib.lines.Line2D object to the same ndarray
> variable.  Then, I call fig.canvas.draw() to redraw the figure, where fig is
> Figure object.
>
> However, the line on the graph never changes.  I print a few entries to the
> console to make sure that the variable is changing.
>
> It seems like the only way I can get the line to update is to create a
> completely new ndarray, update that variable with the new values and use
> set_ydata on my line object.  Then, the redraw works.  Other things that I
> tried that didn't seem to work were:
>
> L1.set_ydata(x[:])
> L1.set_ydata(x.tolist())
> L1.set_ydata(list(x))
>
>
> where L1 is my line object, and x is my ndarray.  To make it redraw I have
> to do something like this.
>
> xnew = numpy.zeros(numpy.size(x,0))
> for k in range(numpy.size(x,0)):
>  xnew[k] = x[k]
> L1.set_ydata(xnew)
> fig.canvas.draw()
>
> Is there some switch I can set to force a redraw of the elements?  I feel
> like I am missing something fundamental.
>
> Thanks,
> Michael
>
>
Michael,

Which version of matplotlib are you using?  Which backend are you using?
Also, could you include a small script or two that demonstrate the problem?
This way, we can poke around with it and see what is up.

Ben Root
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] New Mac binary installer for Python 2.6; do we bother with Python 2.5?

2010-10-06 Thread Christopher Barker
Russell E. Owen wrote:
> For now it is available here:
> 
> though I hope it will end up on the official site at some point.
> 
> I have not tested the wx back end and would be grateful if somebody had 
> time to do so.

It seems to work for me on OS-X 10.5(PPC), Python.org2.6, wxPython2.8.10

> I propose not having a matplotlib binary installer for Python 2.5 and 
> getting a pair for Python 2.7 32-bit (10.3.9 and later) and 64-bit (10.5 
> and later).
> 
> What do others think?

I think that's fine -- look to the future -- 2.6 is now getting pretty 
old, and there is 2.7 and 3.1 to work with.

Thanks for all your work on this.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Graph

2010-10-06 Thread Benjamin Root
On Wed, Oct 6, 2010 at 2:36 PM, Waléria Antunes David <
waleriantu...@gmail.com> wrote:

> Benjamin,
>
> I used the 'ax.set_xscale (' log ')', but the points were even more
> confused. What I need is to increase from 0.0 to 0.2 points, 0.2 to 0.4 ...
> increase the size of the graph. However I do not know if the chart is well
> visualized on a monitor 20''.?
>
>
Are you trying to increase the spacing in the x direction or the y
direction?  Log scaling is a standard trick to achieve this effect.


> And how do I let my chart like this:
> http://www.supernova.lbl.gov/PDFs/SCP2003SNeCMBClust.pdf
> This graph format with vertical line on, something like that.
>
>
Are you asking how to add a vertical line to your graph, or how to have only
the vertical grid lines?

Ben Root
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] New Mac binary installer for Python 2.6; do we bother with Python 2.5?

2010-10-06 Thread Russell E. Owen
I finally got hold of a Mac that can run 10.4 and was finally able to 
build a new binary installer for Python 2.6 (as well as one for PIL 
1.1.7) is truly compatible with Mac OS X 10.3.9.

For now it is available here:

though I hope it will end up on the official site at some point.

I have not tested the wx back end and would be grateful if somebody had 
time to do so.

I attempted to build a binary installer for Python 2.5.x but ran into 
problems: Mac binaries for Python 2.5 aren't compatible with 3rd party 
versions of Tk, which causes a mess for matplotlib. There are 
workarounds, but given the state of Mac python 2.5 I'm not sure it's 
worth the bother.

I propose not having a matplotlib binary installer for Python 2.5 and 
getting a pair for Python 2.7 32-bit (10.3.9 and later) and 64-bit (10.5 
and later).

What do others think?

-- Russell


--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Issue with Redrawing a Line (numpy.ndarray, set_ydata, and draw)

2010-10-06 Thread Michael Cracraft
I have a code that continuously modifies a numpy.ndarray variable.  Then, I
use set_ydata on the matplotlib.lines.Line2D object to the same ndarray
variable.  Then, I call fig.canvas.draw() to redraw the figure, where fig is
Figure object.

However, the line on the graph never changes.  I print a few entries to the
console to make sure that the variable is changing.

It seems like the only way I can get the line to update is to create a
completely new ndarray, update that variable with the new values and use
set_ydata on my line object.  Then, the redraw works.  Other things that I
tried that didn't seem to work were:

L1.set_ydata(x[:])
L1.set_ydata(x.tolist())
L1.set_ydata(list(x))


where L1 is my line object, and x is my ndarray.  To make it redraw I have
to do something like this.

xnew = numpy.zeros(numpy.size(x,0))
for k in range(numpy.size(x,0)):
 xnew[k] = x[k]
L1.set_ydata(xnew)
fig.canvas.draw()

Is there some switch I can set to force a redraw of the elements?  I feel
like I am missing something fundamental.

Thanks,
Michael

-- 
_
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Missing Toolbar Button inside Wx Application

2010-10-06 Thread Stan West
From: Sebastian Rhode [mailto:sebrh...@googlemail.com] 
Sent: Wednesday, September 29, 2010 13:02
 
if I plot an normal figure the toolbar contains an button (looks like a
checkbox), which can be used to edit the lines and axes parameters. But when I
embed such a figure in an Wx application, this specfic button is missing.
Is there a way around it? 

That tool is implemented in the Qt4 backends (and in only those backends, I
believe). If your default backend is Qt4Agg, for example, you would see the
tool when not embedding. For embedding with Wx, you would need the tool
implemented in backend_wx.py, class NavigationToolbar2Wx. Should you like to
look at the Qt4 code, it's in backend_qt4.py, class NavigationToolbar2QT.

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Graph

2010-10-06 Thread Friedrich Romstedt
2010/10/6 Waléria Antunes David :
> I ploted a graph and above this graph I plot another graph about data
> errors.

You can do this in one step by using ax.errorbar()
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.errorbar
.

Try using fmt=',', this will plot pixels as the markers.

Friedrich

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Graph

2010-10-06 Thread Alan G Isaac
On 10/6/2010 1:13 PM, Waléria Antunes David wrote:
> the x-axis scale according with data errors only goes on 1.4, but I would 
> like to display up to 1.5. how I do that?

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.xlim


> I also want to increase the space between 0.0 - 0.2, 0.2 - 0.4, so on so that 
> points can be better visualized.

Change the figsize:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.figure

hth,
Alan Isaac

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Graph

2010-10-06 Thread Benjamin Root
On Wed, Oct 6, 2010 at 12:13 PM, Waléria Antunes David <
waleriantu...@gmail.com> wrote:

> Hi all,
>
> I ploted a graph and above this graph I plot another graph about data
> errors.
> so, the x-axis scale according with data errors only goes on 1.4, but I
> would like to display up to 1.5. how I do that?
> I also want to increase the space between 0.0 - 0.2, 0.2 - 0.4, so on so
> that points can be better visualized.
>
> My image attached
>
> Thanks,
> Waleria
>
>
To set the x limits:
ax.set_xlim([0.0, 1.5])

To increase the space between 0.0-0.2 and 0.2-0.4, you might want to
consider log scale (although zero values will cause problems)?
ax.set_xscale('log')

Ben Root
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bug: axes.hitlist() ?

2010-10-06 Thread Ryan May
On Tue, Oct 5, 2010 at 11:39 PM, Daniel Hyams  wrote:
>
> I've run across a strange problem and perhaps I'm misusing something.  I was
> trying to set up picking so that I can interact with plotted objects, and I
> get alot of error spew that looks like this:
>
> while checking 
> Traceback (most recent call last):
>   File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 241, in
> hitlist
>     hascursor,info = self.contains(event)
>   File "C:\Python26\lib\site-packages\matplotlib\lines.py", line 286, in
> contains
>     path, affine = self._transformed_path.get_transformed_path_and_affine()
> AttributeError: 'NoneType' object has no attribute
> 'get_transformed_path_and_affine'
>
> This can be reproduced by the following code, even though there is no
> picking involved...just mouse motion.  Is there possibly a workaround for
> this, or am I doing something wrong?
>
> import sys
> from pylab import *
>
> ax = subplot(111)
> ax.plot([0,1,2,3])
>
> def on_move(event):
>     if event.inaxes:
>     lst = ax.hitlist(event)
>     print lst
>
> binding_id = connect('motion_notify_event', on_move)
>
>
> show()

It looks like Line2D.contains() was relying on some attributes that
were set by draw(). I'm not sure why those lines are not drawn (it
looks like some axis line?), but contains() shouldn't cause a
traceback regardless. I've fixed this in SVN. If you're not running
SVN, the patch is small, but it should be noted that the error message
you're seeing is purely cosmetic and shouldn't be causing any
problems.

Ryan

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

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem with show()

2010-10-06 Thread Benjamin Root
On Wed, Oct 6, 2010 at 3:21 AM, Jorge Scandaliaris
wrote:

> Jorge Scandaliaris  writes:
> >
> > I was running my example with the -pylab option set in ipython, and
> adding a
> > call to plt.ion() doesn't change things. I also run gtkagg backend. I
> guess I
> > have a problem with my installation of matplotlib, unless this is
> something
> > that changed after mpl-1.0. I will try mpl-svn next and see.
> >
>
> Luckily enough, using mpl-svn solved the problem.
>
> BTW, I had issues following the instructions for cloning the git mirror
> (
> http://matplotlib.sourceforge.net/devel/coding_guide.html#cloning-the-git-mirror
> ).
> Something changed in github, or there's typo somewhere?
>
> Instead of:
> # Download the entire git repository into "matplotlib", name the source
> repository "svn".
> git clone --origin svn g...@github.com:astraw/matplotlib.git
>
> I ended up doing:
> git clone --origin svn git://github.com/astraw/matplotlib.git
>
> The rest of instructions worked fine (at least it seems to me).
>
> Regards,
>
> Jorge
>
>
>
Yeah, those instructions should be changed.  The current instructions would
presume that you would use your github username in-place of the 'git'
username.  Your command works fine for everyone who just wants to pull from
the repo.

Ben Root
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bug: axes.hitlist() ?

2010-10-06 Thread Benjamin Root
On Tue, Oct 5, 2010 at 11:39 PM, Daniel Hyams  wrote:

>
> I've run across a strange problem and perhaps I'm misusing something.  I
> was trying to set up picking so that I can interact with plotted objects,
> and I get alot of error spew that looks like this:
>
> while checking 
> Traceback (most recent call last):
>   File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 241, in
> hitlist
> hascursor,info = self.contains(event)
>   File "C:\Python26\lib\site-packages\matplotlib\lines.py", line 286, in
> contains
> path, affine = self._transformed_path.get_transformed_path_and_affine()
> AttributeError: 'NoneType' object has no attribute
> 'get_transformed_path_and_affine'
>
> This can be reproduced by the following code, even though there is no
> picking involved...just mouse motion.  Is there possibly a workaround for
> this, or am I doing something wrong?
>
> import sys
> from pylab import *
>
> ax = subplot(111)
> ax.plot([0,1,2,3])
>
> def on_move(event):
> if event.inaxes:
> lst = ax.hitlist(event)
> print lst
>
> binding_id = connect('motion_notify_event', on_move)
>
>
> show()
>
>
> --
> Daniel Hyams
> dhy...@gmail.com
>
>
Daniel,

I am not exactly sure of your exact issue, but I did notice something a
little off about your current code.  In on_move(), you reference 'ax', but
that is never passed in or defined in the function itself.  Therefore, it is
refering to the 'ax' that is in your global namespace.  This seems to be a
side issue, however.

Ben Root
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] subplot grids with EPD

2010-10-06 Thread Robin
On Wed, Oct 6, 2010 at 10:31 AM, Jakub Nowacki  wrote:
> Hi,
>
> Personally I've tried to install Matplotlib 1.0.0 manually in EPD on Mac and
> Linux. For some reason on Linux it went totally OK from the first try (just
> had to define PREFIX correctly). On Mac I've tried to do the same but for
> some reason the libs are linked somehow differently and while the
> installation went OK (at least it didn't complain) mpl didn't work. I admit
> I don't have that much experience with Mac linking but it seems to be the
> issue. BTW have you tried to force 32-bit compilation using 'arch'? I was
> getting such messages when I've tired to run 64-bit module with 32-bit
> Python (didn't specify arch correctly).

Thanks for the information. For me it is the same - the build
completes successfully but I get the bus error when importing pyplot.

I think it is 32 bit... I am installing to a 32 bit Python. Also in
the past when I've had arch errors like that they show up at linking
rather than runtime, and I think from the stack trace it is getting
into the extension module ft2font - if it was 64 vs 32 bit I think it
wouldn't load the .so.

I am not sure if EPD is built with intel compilers and MKL - perhaps
that could be the issue. Unfortunately I don't have intel compiler
available to test.

In the end I built against a fresh python.org 2.7 install and
reinstalled numpy and scipy.

Cheers

Robin

>
> Best wishes,
>
> Jakub
>
>
> On 10/05/2010 03:26 PM, Robin wrote:
>>
>> Hi,
>>
>> I am using EPD 6.2 (32 bit)  on a mac.
>>
>> I would like to use subplot grids (matplotlib.gridspec) which seems to
>> require mpl 1.0.0.
>>
>> Is there anyway to install this and use it with EPD? So far I have
>> tried everything from the installation guide, but whatever I do I get
>> a bus error in ft2font.
>>
>> I can't get the wx backend to show up in the config stage (although wx
>> is installed in EPD).
>> I have tried building it myself, with the make.osx script, and with
>> the EPD guide on the installation page, both with gcc 4.0 and gcc 4.2
>> but everything gives the same bus error.
>> I'm actually not sure what compiler is used for EPD so perhaps that is
>> the problem.
>>
>> Alternatively, is there a way to pick out the subplot grid features
>> and use them with the epd matplotlib?
>>
>> If anyone is interested this is the error I get:
>>
>>
>> Exception Type:  EXC_BAD_ACCESS (SIGBUS)
>> Exception Codes: KERN_PROTECTION_FAILURE at 0x
>> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
>>
>> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
>> 0   ???                                 00 0 + 0
>> 1   libSystem.B.dylib                   0x96f31108
>> _Unwind_GetLanguageSpecificData + 24
>> 2   libstdc++.6.dylib                   0x97166d86 __gxx_personality_v0 +
>> 120
>> 3   libgcc_s.1.dylib                    0x0040b476
>> _Unwind_RaiseException_Phase2 + 102 (unwind.inc:68)
>> 4   libgcc_s.1.dylib                    0x0040b890 _Unwind_Resume + 112
>> (unwind.inc:238)
>> 5   ft2font.so                          0x04501a98
>> FT2Font::FT2Font(std::string) + 4776 (ExtensionOldType.hxx:88)
>> 6   ft2font.so                          0x04501fd3
>> ft2font_module::new_ft2font(Py::Tuple const&) + 515 (ft2font.cpp:1969)
>> 7   ft2font.so                          0x045041b6
>> Py::ExtensionModule::invoke_method_varargs(void*,
>> Py::Tuple const&) + 102 (ExtensionModule.hxx:184)
>> 8   ft2font.so                          0x0450db87
>> method_varargs_call_handler + 343
>> 9   org.python.python                   0x000cbfd5 PyEval_EvalFrameEx +
>> 19429
>> 10  org.python.python                   0x000ce14d PyEval_EvalCodeEx +
>> 2109
>> 11  org.python.python                   0x000cc1bc PyEval_EvalFrameEx +
>> 19916
>> 12  org.python.python                   0x000ce14d PyEval_EvalCodeEx +
>> 2109
>> 13  org.python.python                   0x0004b136 function_call + 166
>> 14  org.python.python                   0x00019b05 PyObject_Call + 85
>> 15  org.python.python                   0x0002c0e6 instancemethod_call +
>> 422
>> 16  org.python.python                   0x00019b05 PyObject_Call + 85
>> 17  org.python.python                   0x000c642e
>> PyEval_CallObjectWithKeywords + 78
>> 18  org.python.python                   0x0002efb2 PyInstance_New + 114
>> 19  org.python.python                   0x00019b05 PyObject_Call + 85
>> 20  org.python.python                   0x000ca927 PyEval_EvalFrameEx +
>> 13623
>> 21  org.python.python                   0x000cc956 PyEval_EvalFrameEx +
>> 21862
>> 22  org.python.python                   0x000ce14d PyEval_EvalCodeEx +
>> 2109
>> 23  org.python.python                   0x000ce2d7 PyEval_EvalCode + 87
>> 24  org.python.python                   0x000e5a3c
>> PyImport_ExecCodeModuleEx + 188
>> 25  org.python.python                   0x000e66dc load_source_module +
>> 540
>> 26  org.python.python                   0x000e72fd import_submodule + 301
>> 27  org.python.

Re: [Matplotlib-users] Problem with show()

2010-10-06 Thread Jorge Scandaliaris
Jorge Scandaliaris  writes:
> 
> I was running my example with the -pylab option set in ipython, and adding a
> call to plt.ion() doesn't change things. I also run gtkagg backend. I guess I
> have a problem with my installation of matplotlib, unless this is something 
> that changed after mpl-1.0. I will try mpl-svn next and see.
> 

Luckily enough, using mpl-svn solved the problem. 

BTW, I had issues following the instructions for cloning the git mirror
(http://matplotlib.sourceforge.net/devel/coding_guide.html#cloning-the-git-mirror).
Something changed in github, or there's typo somewhere?

Instead of:
# Download the entire git repository into "matplotlib", name the source
repository "svn".
git clone --origin svn g...@github.com:astraw/matplotlib.git

I ended up doing:
git clone --origin svn git://github.com/astraw/matplotlib.git

The rest of instructions worked fine (at least it seems to me).

Regards,

Jorge




--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users