[Matplotlib-users] matplotlib breaks: ValueError: ordinal must be >= 1 from matplotlib/dates.py", line 170, in _from_ordinalf

2009-07-14 Thread M Osborne
I am trying to plot some historical trend data, where x is a date and
y is a percentage.

When I try to insert a horizontal line with ax1.axhline(y=80,
linewidth=1, color='r'), matplotlib breaks, with an error "
ValueError: ordinal must be >= 1".

The Traceback most recent call is,  File
"/usr/lib64/python2.4/site-packages/matplotlib/dates.py", line 170, in
_from_ordinalf
dt = datetime.datetime.fromordinal(ix)"

Without the axhline element, matplotlib handles the data fine, and
plots nice weekly dates.

I'm guessing based on the error that axhline is manually forcing
autoscale off and/or matplotlib can no longer interpret the date
values for x?

Below is the matplotlib snippet of my code:

fig = plt.figure(figsize=(20,10))
font = { 'fontname':'Tahoma', 'fontsize':12 }
ax1 = fig.add_subplot(211)
ax1.set_ylim(0,100)
ax1.autoscale_view(tight=False, scalex=True, scaley=False)
ax1.grid(True)
ax1.axhline(y=80, linewidth=1, color='r')
ax1.set_ylim(0,100)
ax1.autoscale_view(tight=False, scalex=True, scaley=False)
ax1.plot(timestamp, percentu, 'ko-' )
ax1.plot(timestamp, percentl, 'b--', linewidth=2)
ax2 = fig.add_subplot(212)
ax2.grid(True)
ax2.plot(predict_x, predict_y, 'bs--', linewidth=2)
plt.savefig("plot.pdf")


Thank you in advance!

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] question about setting colors of lines using colormap

2009-07-14 Thread per freem
Hi all,

i would like to set the colors of the lines i plot (using the plot function)
to go from red to blue, in evenly spaced interval. that is, imagine a color
map from red to green, where i plot n-many lines, each receiving a color
from this color map, starting at the red end and going to green.

the docs say how to set the color cycle of lines set by plot, using:

matplotlib.axes.set_default_color_cycle(['r', 'y', 'g', 'b'])

but this only allows me to use named colors, and here i am looking to use
shades from red to green.
my question is: first, how can i generate N evenly spaced colors from the
red spectrum to the green spectrum? and two, how can i make it so plot uses
these colors for its line plots?

thanks very much.
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] question about setting colors of lines using colormap

2009-07-14 Thread Tony S Yu
Not too long ago, I posted an example of this to the list. The code  
near the bottom of that thread is a little more general than the one  
at the top and shows, three different ways to cycle through the colors  
of a colormap.


Hope that helps,
-Tony


On Jul 14, 2009, at 9:51 AM, per freem wrote:


Hi all,

i would like to set the colors of the lines i plot (using the plot  
function) to go from red to blue, in evenly spaced interval. that  
is, imagine a color map from red to green, where i plot n-many  
lines, each receiving a color from this color map, starting at the  
red end and going to green.


the docs say how to set the color cycle of lines set by plot, using:

matplotlib.axes.set_default_color_cycle(['r', 'y', 'g', 'b'])

but this only allows me to use named colors, and here i am looking  
to use shades from red to green.
my question is: first, how can i generate N evenly spaced colors  
from the red spectrum to the green spectrum? and two, how can i make  
it so plot uses these colors for its line plots?


thanks very much.
--
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited  
time,
vendors submitting new applications to BlackBerry App World(TM) will  
have
the opportunity to enter the BlackBerry Developer Challenge. See  
full prize

details at: 
http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib breaks: ValueError: ordinal must be >= 1 from matplotlib/dates.py", line 170, in _from_ordinalf

2009-07-14 Thread Jae-Joon Lee
Please post a standalone example that reproduces your problem.
I tried your example with some junk data but no such exception is raised.

However, there has been a report of a similar ordinal value problem
which I think is not fixed yet, but that problem only occurs when two
and more axes are shared.

See if below helps,
 * move the axhline call after the plotting commands.
 * autoscale only after all the necessary plot elements are in place.

Again, please post a standalone example that reproduces your problem.

Regards,

-JJ


On Tue, Jul 14, 2009 at 9:50 AM, M Osborne wrote:
> I am trying to plot some historical trend data, where x is a date and
> y is a percentage.
>
> When I try to insert a horizontal line with ax1.axhline(y=80,
> linewidth=1, color='r'), matplotlib breaks, with an error "
> ValueError: ordinal must be >= 1".
>
> The Traceback most recent call is,  File
> "/usr/lib64/python2.4/site-packages/matplotlib/dates.py", line 170, in
> _from_ordinalf
>    dt = datetime.datetime.fromordinal(ix)"
>
> Without the axhline element, matplotlib handles the data fine, and
> plots nice weekly dates.
>
> I'm guessing based on the error that axhline is manually forcing
> autoscale off and/or matplotlib can no longer interpret the date
> values for x?
>
> Below is the matplotlib snippet of my code:
>
>        fig = plt.figure(figsize=(20,10))
>        font = { 'fontname':'Tahoma', 'fontsize':12 }
>        ax1 = fig.add_subplot(211)
>        ax1.set_ylim(0,100)
>        ax1.autoscale_view(tight=False, scalex=True, scaley=False)
>        ax1.grid(True)
>        ax1.axhline(y=80, linewidth=1, color='r')
>        ax1.set_ylim(0,100)
>        ax1.autoscale_view(tight=False, scalex=True, scaley=False)
>        ax1.plot(timestamp, percentu, 'ko-' )
>        ax1.plot(timestamp, percentl, 'b--', linewidth=2)
>        ax2 = fig.add_subplot(212)
>        ax2.grid(True)
>        ax2.plot(predict_x, predict_y, 'bs--', linewidth=2)
>        plt.savefig("plot.pdf")
>
>
> Thank you in advance!
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib-0.98.5.3.win32-py2.6.exe (Stephen George)

2009-07-14 Thread Jon Roadley-Battin
Question is however, are you using the GTK backend?
ie

from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as
FigureCanvas
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as
NavigationToolbar

backend_gtkagg then imports matplotlib.backends._gtkagg
For matplotlib-0.98.5.2.win32-py2.5.exe
C:\Python25\Lib\site-packages\matplotlib\backends\_gtkagg.pyd  exists

For matplotlib-0.98.5.3.win32-py2.6.exe
C:\Python26\Lib\site-packages\matplotlib\backends\_gtkagg.pyd doesn't

ie gtk backend doesn't seem to be compiled.
matplotlib is the only thing holding me back in moving to python26 (on
windows). Hopefully the svn build is updated soon or a new release is due
soon (I can wait )


>Hi Christoph,
> >
> >Sorry for my delay to get back to you.
> >
> >The svn version seems to work fine with GTK support, at least my
> >application had no problems running
> >
> >The versions I tested with are as follows:
> >  python version: 2.6.0 final 0
> >   numpy version: 1.3.0

>  matplotlib version: 0.98.6svn
> >   gtk+ version: 2.16.2
> >   pyGTK version: 2.12.1
> >
> >Thank you
> >you have been a big help
>
> >Steve
>
>
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] speeding-up griddata()

2009-07-14 Thread Robert Kern
On 2009-07-13 13:20, Robert Cimrman wrote:
> Hi all,
>
> I would like to use griddata() to interpolate a function given at
> specified points of a bunch of other points. While the method works
> well, it slows down considerably as the number of points to interpolate
> to increases.
>
> The dependence of time/(number of points) is nonlinear (see the
> attachment) - it seems that while the Delaunay trinagulation itself is
> fast, I wonder how to speed-up the interpolation. The docstring says,
> that it is based on "natural neighbor interpolation" - how are the
> neighbors searched?

Using the Delaunay triangulation. The "natural neighbors" of an interpolation 
point are those points participating in triangles in the Delaunay triangulation 
whose circumcircles include the interpolation point. The triangle that encloses 
the interpolation point is found by a standard walking procedure, then the 
neighboring triangles (natural or otherwise) are explored in a breadth-first 
search around the starting triangle to find the natural neighbors.

Unfortunately, griddata() uses the unstructured-interpolation-points API rather 
than the more efficient grid-interpolation-points API. In the former, each 
interpolation point uses the last-found enclosing triangle as the start of the 
walking search. This works well where adjacent interpolation points are close 
to 
each other. This is not the case at the ends of the grid rows. The latter API 
is 
smarter and starts a new row of the grid with the triangle from the triangle 
from the *start* of the previous row rather than the end. I suspect this is 
largely the cause of the poor performance.

> Does it use the kd-trees like scipy.spatial? I have
> a very good experience with scipy.spatial performance.
>
> Also, is there a way of reusing the triangulation when interpolating
> several times using the same grid?

One would construct a Triangulation() object with the (x,y) data points, get a 
new NNInterpolator() object using the .nn_interpolator(z) method for each new z 
data set, and then interpolate your grid on the NNInterpolator.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] speeding-up griddata()

2009-07-14 Thread Robert Cimrman
Robert Kern wrote:
> On 2009-07-13 13:20, Robert Cimrman wrote:
>> Hi all,
>>
>> I would like to use griddata() to interpolate a function given at
>> specified points of a bunch of other points. While the method works
>> well, it slows down considerably as the number of points to interpolate
>> to increases.
>>
>> The dependence of time/(number of points) is nonlinear (see the
>> attachment) - it seems that while the Delaunay trinagulation itself is
>> fast, I wonder how to speed-up the interpolation. The docstring says,
>> that it is based on "natural neighbor interpolation" - how are the
>> neighbors searched?
> 
> Using the Delaunay triangulation. The "natural neighbors" of an interpolation 
> point are those points participating in triangles in the Delaunay 
> triangulation 
> whose circumcircles include the interpolation point. The triangle that 
> encloses 
> the interpolation point is found by a standard walking procedure, then the 
> neighboring triangles (natural or otherwise) are explored in a breadth-first 
> search around the starting triangle to find the natural neighbors.

I see, thanks for the explanation. The walking procedure is what is 
described e.g. in [1], right? (summary; starting from a random triangle, 
a line is made connecting that triangle with the interpolation point, 
and triangles along that line are probed.)

[1] http://www.geom.uiuc.edu/software/cglist/GeomDir/ptloc96.ps.gz

> Unfortunately, griddata() uses the unstructured-interpolation-points API 
> rather 
> than the more efficient grid-interpolation-points API. In the former, each 
> interpolation point uses the last-found enclosing triangle as the start of 
> the 
> walking search. This works well where adjacent interpolation points are close 
> to 
> each other. This is not the case at the ends of the grid rows. The latter API 
> is 
> smarter and starts a new row of the grid with the triangle from the triangle 
> from the *start* of the previous row rather than the end. I suspect this is 
> largely the cause of the poor performance.

Good to know, I will try to pass the points in groups of close points.

>> Does it use the kd-trees like scipy.spatial? I have
>> a very good experience with scipy.spatial performance.
>>
>> Also, is there a way of reusing the triangulation when interpolating
>> several times using the same grid?
> 
> One would construct a Triangulation() object with the (x,y) data points, get 
> a 
> new NNInterpolator() object using the .nn_interpolator(z) method for each new 
> z 
> data set, and then interpolate your grid on the NNInterpolator.

So if the above fails, I can bypass griddata() by using the delaunay 
module directly, good.

thank you,
r.


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plot a line with an arrow

2009-07-14 Thread Afi Welbeck
Hi all,

I'm a newbie, I'm trying to plot a line with an arrow
(arrow in the  middle and another with an arrow at
the end) with the following points: [1, 2] and [5, 2]
Could anyone please help me with the code?
Thanks.
Harriet A. Welbeck



  --
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] speeding-up griddata()

2009-07-14 Thread Robert Kern
On 2009-07-14 12:52, Robert Cimrman wrote:
> Robert Kern wrote:
>> On 2009-07-13 13:20, Robert Cimrman wrote:
>>> Hi all,
>>>
>>> I would like to use griddata() to interpolate a function given at
>>> specified points of a bunch of other points. While the method works
>>> well, it slows down considerably as the number of points to interpolate
>>> to increases.
>>>
>>> The dependence of time/(number of points) is nonlinear (see the
>>> attachment) - it seems that while the Delaunay trinagulation itself is
>>> fast, I wonder how to speed-up the interpolation. The docstring says,
>>> that it is based on "natural neighbor interpolation" - how are the
>>> neighbors searched?
>> Using the Delaunay triangulation. The "natural neighbors" of an interpolation
>> point are those points participating in triangles in the Delaunay 
>> triangulation
>> whose circumcircles include the interpolation point. The triangle that 
>> encloses
>> the interpolation point is found by a standard walking procedure, then the
>> neighboring triangles (natural or otherwise) are explored in a breadth-first
>> search around the starting triangle to find the natural neighbors.
>
> I see, thanks for the explanation. The walking procedure is what is
> described e.g. in [1], right? (summary; starting from a random triangle,
> a line is made connecting that triangle with the interpolation point,
> and triangles along that line are probed.)
>
> [1] http://www.geom.uiuc.edu/software/cglist/GeomDir/ptloc96.ps.gz

Yes.

>>> Does it use the kd-trees like scipy.spatial? I have
>>> a very good experience with scipy.spatial performance.
>>>
>>> Also, is there a way of reusing the triangulation when interpolating
>>> several times using the same grid?
>> One would construct a Triangulation() object with the (x,y) data points, get 
>> a
>> new NNInterpolator() object using the .nn_interpolator(z) method for each 
>> new z
>> data set, and then interpolate your grid on the NNInterpolator.
>
> So if the above fails, I can bypass griddata() by using the delaunay
> module directly, good.

Yes. griddata is a fairly light wrapper that exists mainly to sanitize inputs 
and allow use of the natgrid implementation easily.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] question about setting colors of lines using colormap

2009-07-14 Thread per freem
Hi Tony,

thanks for the pointer.  that code does not run for me, it generates the
following error:

ttributeErrorTraceback (most recent call last)

color_cycle.py in ()
 63 if __name__ == '__main__':
 64 n_lines = 10
---> 65 cycle_cmap(length=n_lines)
 66 x = np.linspace(0, 10)
 67 for shift in np.linspace(0, np.pi, n_lines):

color_cycle.py in cycle_cmap(cmap, length)
 59 idx = np.linspace(crange['start'], crange['stop'],
length).astype(np.int)
 60 colors = cm(idx)
---> 61 mpl.axes.set_default_color_cycle(colors.tolist())
 62
 63 if __name__ == '__main__':

/Library/Python/2.5/site-packages/matplotlib/axes.pyc in
set_default_color_cycle(clist)
113 """
114 _process_plot_var_args.defaultColors = clist[:]
--> 115 rcParams['lines.color'] = clist[0]
116
117 class _process_plot_var_args:

/Library/Python/2.5/site-packages/matplotlib/__init__.pyc in
__setitem__(self, key, val)
603 instead.'% (key, alt))
604 key = alt
--> 605 cval = self.validate[key](val)
606 dict.__setitem__(self, key, cval)
607 except KeyError:

/Library/Python/2.5/site-packages/matplotlib/rcsetup.pyc in
validate_color(s)
160 def validate_color(s):
161 'return a valid color arg'
--> 162 if s.lower() == 'none':
163 return 'None'
164 if is_color_like(s):

AttributeError: 'list' object has no attribute 'lower'
WARNING: Failure executing file: 

any idea what might be wrong?


On Tue, Jul 14, 2009 at 10:14 AM, Tony S Yu  wrote:

> Not too long ago, I posted an example of this to the 
> list.
> The code near the bottom of that thread is a little more general than the
> one at the top and shows, three different ways to cycle through the colors
> of a colormap.
>
> Hope that helps,
> -Tony
>
>
> On Jul 14, 2009, at 9:51 AM, per freem wrote:
>
> Hi all,
>
> i would like to set the colors of the lines i plot (using the plot
> function) to go from red to blue, in evenly spaced interval. that is,
> imagine a color map from red to green, where i plot n-many lines, each
> receiving a color from this color map, starting at the red end and going to
> green.
>
> the docs say how to set the color cycle of lines set by plot, using:
>
> matplotlib.axes.set_default_color_cycle(['r', 'y', 'g', 'b'])
>
> but this only allows me to use named colors, and here i am looking to use
> shades from red to green.
> my question is: first, how can i generate N evenly spaced colors from the
> red spectrum to the green spectrum? and two, how can i make it so plot uses
> these colors for its line plots?
>
> thanks very much.
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
>
> details at:
> http://p.sf.net/sfu/Challenge___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] question about setting colors of lines using colormap

2009-07-14 Thread Tony S Yu


On Jul 14, 2009, at 3:12 PM, per freem wrote:


Hi Tony,

thanks for the pointer.  that code does not run for me, it generates  
the following error:


ttributeErrorTraceback (most recent call  
last)






/Library/Python/2.5/site-packages/matplotlib/rcsetup.pyc in  
validate_color(s)

160 def validate_color(s):
161 'return a valid color arg'
--> 162 if s.lower() == 'none':
163 return 'None'
164 if is_color_like(s):

AttributeError: 'list' object has no attribute 'lower'
WARNING: Failure executing file: 

any idea what might be wrong?


Hmm, it looks like there was a fix added a couple of months ago (svn  
revision 7164). If you're on trunk, then updating it should fix this  
problem. If you're not on trunk: I don't think any official releases  
have occurred since this fix, so I don't think updating to the last  
official release will help.


In any case, I think this error only affects the ``cycle_cmap``  
function in the code (calls to ``cmap_intervals`` should work fine).  
If you comment out the 4 lines of code after the comment "Change the  
default color cycle", I believe everything should work fine.


-Tony--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] The vertical part of y error bars. Where are they?

2009-07-14 Thread Jack Sankey
Hello,
I'm writing a script that removes data from plots by looping over
axes.get_lines(), removing data, then using axes.set_lines(). It works quite
well, but when it's a plot with error bars, the vertical part of the error
bar is not disappearing.

I'm assuming the vertical part is a vline or something and so should not be
with the other lines. Where does this data get stuck? :)

Thanks!
Jack
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib-0.98.5.3.win32-py2.6.exe (Stephen George)

2009-07-14 Thread Stephen George
Hi Jon,

To clarify, I think you need to read Christoph Gohlke original message 
(7/7/2009) to me to put my response into context:
> Hi Steve,
>
> matplotlib-0.98.5.3.win32-py2.6.exe was compiled without support for GTK.
>
> If you don't mind trying, I have a build of the matplotlib trunk 
> available on my homepage that has GTK support enabled:
>
> http://www.lfd.uci.edu/~gohlke/#pythonlibs
>
> It should work with the PyGTK 2.12 Windows binaries from 
> http://www.pygtk.org/downloads.html.
>
> SVG support seems broken: the window.set_icon_from_file() function in 
> backend_gtk.py will raise an exception, not recognizing SVG files. The 
> PNG icon works.
>
> Christoph
>   

 From that web page I downloaded 
http://www.lfd.uci.edu/~gohlke/download/matplotlib-0.98.6svn.win32-py2.6.exe
NOTICE the version number 0.98.6svn

Then in my code I have the following lines:

from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as 
NavigationToolbar

For your benefit I changed to the same backend as yours ( GTKAgg backend 
) and run again

My application ran successfully with both the GTKAgg and GTKCario backends.
Why don't you take the svn version for a spin, you might also have success.

Hope this has been of some help
Steve


Jon Roadley-Battin wrote:
> Question is however, are you using the GTK backend?
> ie
>
> from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as 
> FigureCanvas
> from matplotlib.backends.backend_gtkagg import 
> NavigationToolbar2GTKAgg as NavigationToolbar
>
> backend_gtkagg then imports matplotlib.backends._gtkagg
> For matplotlib-0.98.5.2.win32-py2.5.exe
> C:\Python25\Lib\site-packages\matplotlib\backends\_gtkagg.pyd  exists
>
> For matplotlib-0.98.5.3.win32-py2.6.exe
> C:\Python26\Lib\site-packages\matplotlib\backends\_gtkagg.pyd doesn't
>
> ie gtk backend doesn't seem to be compiled.
> matplotlib is the only thing holding me back in moving to python26 (on 
> windows). Hopefully the svn build is updated soon or a new release is 
> due soon (I can wait )
>  
>
> >Hi Christoph,
> >
> >Sorry for my delay to get back to you.
> >
> >The svn version seems to work fine with GTK support, at least my
> >application had no problems running
> >
> >The versions I tested with are as follows:
> >  python version: 2.6.0 final 0
> >   numpy version: 1.3.0
>
> >  matplotlib version: 0.98.6svn
> >   gtk+ version: 2.16.2
> >   pyGTK version: 2.12.1
> >
> >Thank you
> >you have been a big help
>
> >Steve
>
>
> 
>
> --
> Enter the BlackBerry Developer Challenge  
> This is your chance to win up to $100,000 in prizes! For a limited time, 
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize  
> details at: http://p.sf.net/sfu/Challenge
> 
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] unable to plot multiple lines with plot?

2009-07-14 Thread per freem
hi all,

i'm getting very strange behavior from the matplotlib 'plot' function when
attempting to plot multiple lines. i have a series of x, y data points that
are being generated in a loop and i want to simply plot each of them on the
same plot. my code is:

import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['ps.useafm'] = True
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})

my_fig = plt.figure(figsize=(6,5), dpi=100)
num_lines = 3

for n in range(0, num_lines):
print "Printing line %d" %(n+1)
x = range(0, 100)
y = (ones(100)*(n+1))
plt.plot(x, y)

plt.savefig('plot_example.pdf')

when I do this, it only plots the last line (a horizontal line at y = 3).
how can i get to actually plot all three lines?

more strangely, it shows *stochastic* behavior: sometimes when i run the
code, it generates a green line at y = 3, and other times a blue line. from
plot to plot, the upper bound of the y axis changes, sometimes being 3.15,
sometimes 3.2.  i'm not sure why it is doing that.

how can i get it to simply add whatever i plot in the body of the 'for' loop
to the same graph? i tried adding plt.plot() after my call to plt.plot but
that did not fix it.

thank you.
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] unable to plot multiple lines with plot?

2009-07-14 Thread Jeff Whitaker
per freem wrote:
> hi all,
>
> i'm getting very strange behavior from the matplotlib 'plot' function 
> when attempting to plot multiple lines. i have a series of x, y data 
> points that are being generated in a loop and i want to simply plot 
> each of them on the same plot. my code is:
>
> import matplotlib
> matplotlib.use('PDF')
> import matplotlib.pyplot as plt
> from matplotlib import rc
> rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
> plt.rcParams['ps.useafm'] = True
> rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
>
> my_fig = plt.figure(figsize=(6,5), dpi=100)
> num_lines = 3
>
> for n in range(0, num_lines):
> print "Printing line %d" %(n+1)
> x = range(0, 100)
> y = (ones(100)*(n+1))
> plt.plot(x, y)
>
> plt.savefig('plot_example.pdf')
>
> when I do this, it only plots the last line (a horizontal line at y = 
> 3). how can i get to actually plot all three lines?
>
> more strangely, it shows *stochastic* behavior: sometimes when i run 
> the code, it generates a green line at y = 3, and other times a blue 
> line. from plot to plot, the upper bound of the y axis changes, 
> sometimes being 3.15, sometimes 3.2.  i'm not sure why it is doing that.
>
> how can i get it to simply add whatever i plot in the body of the 
> 'for' loop to the same graph? i tried adding plt.plot() after my call 
> to plt.plot but that did not fix it.
>
> thank you.

Per:  The plots are there, you just can't see them because the y-axis 
has been auto-scaled so that the first and last lines lie on the top and 
bottom of the plot window.  Just add plt.ylim(0,4) after the loop and 
you will see all three lines.

-Jeff


--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users