Re: [Matplotlib-users] debian install

2008-07-09 Thread Sandro Tosi
Hello Ben,

On Wed, Jul 9, 2008 at 19:37, Ben Axelrod <[EMAIL PROTECTED]> wrote:
> I get errors when I add:
>
>   deb http://anakonda.altervista.org/debian packages/
>
>   deb-src http://anakonda.altervista.org/debian sources/
>
> to my /etc/apt/sources.list.  Is this still the preferred method for
> installing on Debian?

Matplotlib is available on official debian repository[1] at version
0.98.1 (and hopefully soon 0.98.2) both for unstable and testing.
Maybe you're on stable?

Cheers,
Sandro

[1] http://packages.qa.debian.org/m/matplotlib.html

-- 
Sandro Tosi (aka morph, Morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] creating colormaps

2008-07-09 Thread Marjolaine Rouault
Thanks Eric,

That is much better. I am going to try and implement it now and see how I go. I 
will let you know.

Regards, Marjolaine.

>>> Eric Firing <[EMAIL PROTECTED]> 07/09/08 11:12 PM >>>
Marjolaine Rouault wrote:
> Hi,
> 
> I don't understand how one creates his own colormap. i am using
> matplotlib and I have checked the example in
> http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps but I can't
> really understand how it works. Are there any other examples out
> there? I want to create a colormap a bit like the one at this url:
> 
> http://www.pyngl.ucar.edu/Graphics/Images/ViBlGrWhYeOrRe.gif
> 
> best regards, Marjolaine.
> 
> 
> 

Marjolaine,

Depending on your starting point--what you know about your desired 
colormap--you can use either a LinearSegmentedColormap or a 
ListedColormap.  If you already have a colormap in the form of a list of 
evenly-spaced colors, then the simplest way to get it into mpl is by 
using that list to initialize a ListedColormap.  If, instead, you have a 
general idea of how you want R, G, and B to vary over the range of the 
map, then you probably need the LinearSegmentedColormap.

Every description of the LinearSegmentedColormap class that I have seen 
is confusing, even though the way it works is fairly simple.  Let's see 
if I can make it a little less confusing.

Example: suppose you want red to increase from 0 to 1 over the bottom 
half, green to do the same over the middle half, and blue over the top 
half.  Then you would use:

cdict = { 'red': ((0, 0, 0),
   (0.5, 1, 1),
   (1, 1, 1)),
   'green': ((0, 0, 0),
 (0.25, 0, 0),
 (0.75, 1, 1),
 (1, 1, 1)),
'blue': ((0, 0, 0),
 (0.5, 0, 0),
 (1, 1, 1))}

If, as in this example, there are no discontinuities in the r, g, and b 
components, then it is quite simple: the second and third element of 
each tuple, above, is the same--call it "y".  The first element ("x") 
defines interpolation intervals over the full range of 0 to 1, and it 
must span that whole range.  In other words, the values of x divide the 
0-to-1 range into a set of segments, and y gives the end-point color 
values for each segment.

Now consider the green. cdict['green'] is saying that for
0 <= x <= 0.25, y is zero; no green.
0.25 < x <= 0.75, y varies linearly from 0 to 1.
x > 0.75, y remains at 1, full green.

If there are discontinuities, then it is a little more complicated. 
Label the 3 elements in each row in the cdict entry for a given color as 
(x, y0, y1).  Then for values of x between x[i] and x[i+1] the color 
value is interpolated between y1[i] and y0[i+1].

Going back to the cookbook example, look at cdict['red']; because y0 != 
y1, it is saying that for x from 0 to 0.5, red increases from 0 to 1, 
but then it jumps down, so that for x from 0.5 to 1, red increases from 
0.7 to 1.  Green ramps from 0 to 1 as x goes from 0 to 0.5, then jumps 
back to 0, and ramps back to 1 as x goes from 0.5 to 1.

row i:   x  y0  y1
/
   /
row i+1: x  y0  y1

Above is an attempt to show that for x in the range x[i] to x[i+1], the 
interpolation is between y1[i] and y0[i+1].  So, y0[0] and y1[-1] are 
never used.

I hope I got all that right--I would welcome close checking.  I want to 
get an adequate and correct explanation into the standard mpl documentation.


Eric



-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.


-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] keeping axis settings while adding data

2008-07-09 Thread Ryan May
Lubos Vrbka wrote:
> hello,
> 
>> why is it actually not possible to do something like the following piece 
>> of code?
>> ioff()
>> plot commands
>> draw()
>> ion()
> actually, i did some test now (modification of the example 
> http://www.scipy.org/Cookbook/Matplotlib/Animations site):
> 
> from pylab import *
> ioff()
> x = arange(0,2*pi,0.01)# x-array
> line, = plot(x,sin(x))
> draw()
> 
> displays nothing, then
> 
> ion()
> for i in arange(1,200):
>   line.set_ydata(sin(x+i/10.0))  # update the data
>   draw() # redraw the canvas
> 
> displays nothing as well, but shows the same 'lag' as when running the 
> whole code in interactive mode. that means that the data is processed, 
> the graphics is plotted, just the window is not displayed.
> 
> i thought that ioff() is present exactly for this purpose. 
> unfortunately, the documentation page
> 
> http://matplotlib.sourceforge.net/interactive.html
> 
> shows only an example where an image file is produced first with ioff(), 
> the figure is closed and something is then displayed with ion().
> 
> when i later issue another plot() command (i.e., plot(random(20), 
> random(20)), it is displayed and shows also the last part of the sin(x) 
> plot...
> 
> the thing i want to achieve is maybe impossible - i'd just love to know 
> why, or what am i doing wrong... i'm very grateful for any hints.

Try looking at the dynamic_image_*.py in the examples directory (or 
examples/animation for version 0.98.x).  I've personally used the 
dynamic_image_gtkagg.py approach for (what I think is) a similar use 
case to yours.  Before finding that one, I went through a variety of 
approaches with threading, ion()/ioff() and draw().

Ryan

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

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fwd: Re: Autonomous display of image/plot/figure

2008-07-09 Thread Ryan May
James K. Gruetzner wrote:
> Thanks for the suggestion, Michael.   Reading it led to a bit of a forehead
> slap.
> 
> Unfortunately, that didn't work either.  Curiously, it appears that
> the "show()" command does not return.
> 
> - CODE SECTION -
> #!/usr/local/bin/python
> 
> import os,sys
> import pylab
> 
> def main():
>   x = pylab.linspace(-10,10,100)
>   y = pylab.sin(x)
>   pylab.plot(x,y)
>   sys.stderr.write("Begun.")
>   pylab.show()
>   sys.stderr.write("Done.")
> 
> if __name__ == "__main__":
>   main()
>  END CODE -
> 
> When executed from the command line:
> $ ./test.py &
>. . . the plot displays; clicking on the X closes it, but the process keeps
> on running.
> 
> When executed as an argument to python:
> $ python test.py &
>  . . . the same behavior (except it's a python process which hangs).
> 
> The two sys.stderr.write() statements are for debugging.  The first one
> executes; the second does not.  My conclusion is that the show() command does
> not return.
> 
> --
> When I operate interactively,
>   the command "pylab.plot(x,y)" opens a widow labeled "Figure 1".
>  . . . then . . .
>   the command "show()" writes the plot to that window (i.e., sine plot).
> 
> Clicking the X in the figure window causes the window to disappear, but
> the "show()" command fails to return.
> 
> --
> 
> So . . . I figure that the lack of show() returning is the root problem.
> 
> Any suggestions?
> 
>  I'm running Fedora 8, python 2.5.1, and matplotlib 0.91.2-1.fc8  from the yum
> repository.   Backend is set to GTKAgg in my matplotlibrc file.
> 
(On this list top-posting is frowned upon -- it makes the conversation 
difficult to follow.)

Your analysis is correct, the call to show() activates the GUI mainloop 
and does not return until the window is closed.  Within ipython there is 
some magic that occurs that runs the mainloop in a separate thread. 
What do you need to do after the call to show()?

Ryan

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

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] creating colormaps

2008-07-09 Thread Eric Firing
Marjolaine Rouault wrote:
> Hi,
> 
> I don't understand how one creates his own colormap. i am using
> matplotlib and I have checked the example in
> http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps but I can't
> really understand how it works. Are there any other examples out
> there? I want to create a colormap a bit like the one at this url:
> 
> http://www.pyngl.ucar.edu/Graphics/Images/ViBlGrWhYeOrRe.gif
> 
> best regards, Marjolaine.
> 
> 
> 

Marjolaine,

Depending on your starting point--what you know about your desired 
colormap--you can use either a LinearSegmentedColormap or a 
ListedColormap.  If you already have a colormap in the form of a list of 
evenly-spaced colors, then the simplest way to get it into mpl is by 
using that list to initialize a ListedColormap.  If, instead, you have a 
general idea of how you want R, G, and B to vary over the range of the 
map, then you probably need the LinearSegmentedColormap.

Every description of the LinearSegmentedColormap class that I have seen 
is confusing, even though the way it works is fairly simple.  Let's see 
if I can make it a little less confusing.

Example: suppose you want red to increase from 0 to 1 over the bottom 
half, green to do the same over the middle half, and blue over the top 
half.  Then you would use:

cdict = { 'red': ((0, 0, 0),
   (0.5, 1, 1),
   (1, 1, 1)),
   'green': ((0, 0, 0),
 (0.25, 0, 0),
 (0.75, 1, 1),
 (1, 1, 1)),
'blue': ((0, 0, 0),
 (0.5, 0, 0),
 (1, 1, 1))}

If, as in this example, there are no discontinuities in the r, g, and b 
components, then it is quite simple: the second and third element of 
each tuple, above, is the same--call it "y".  The first element ("x") 
defines interpolation intervals over the full range of 0 to 1, and it 
must span that whole range.  In other words, the values of x divide the 
0-to-1 range into a set of segments, and y gives the end-point color 
values for each segment.

Now consider the green. cdict['green'] is saying that for
0 <= x <= 0.25, y is zero; no green.
0.25 < x <= 0.75, y varies linearly from 0 to 1.
x > 0.75, y remains at 1, full green.

If there are discontinuities, then it is a little more complicated. 
Label the 3 elements in each row in the cdict entry for a given color as 
(x, y0, y1).  Then for values of x between x[i] and x[i+1] the color 
value is interpolated between y1[i] and y0[i+1].

Going back to the cookbook example, look at cdict['red']; because y0 != 
y1, it is saying that for x from 0 to 0.5, red increases from 0 to 1, 
but then it jumps down, so that for x from 0.5 to 1, red increases from 
0.7 to 1.  Green ramps from 0 to 1 as x goes from 0 to 0.5, then jumps 
back to 0, and ramps back to 1 as x goes from 0.5 to 1.

row i:   x  y0  y1
/
   /
row i+1: x  y0  y1

Above is an attempt to show that for x in the range x[i] to x[i+1], the 
interpolation is between y1[i] and y0[i+1].  So, y0[0] and y1[-1] are 
never used.

I hope I got all that right--I would welcome close checking.  I want to 
get an adequate and correct explanation into the standard mpl documentation.


Eric


-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] debian install

2008-07-09 Thread Michael Droettboom
The matplotlib developers don't maintain that repository (which appears 
to be empty at present).  Send a note of to its owner.

matplotlib (of some version at least) exists in the standard Debian 
repositories.  You can install it from there.  Or install from source if 
you need something newer.

Cheers,
Mike

Ben Axelrod wrote:
>
> I get errors when I add:
>
>   deb http://anakonda.altervista.org/debian packages/
>
>   deb-src http://anakonda.altervista.org/debian sources/
>
> to my /etc/apt/sources.list.  Is this still the preferred method for 
> installing on Debian?
>
>  
>
> Thanks,
>
> -Ben
>
> 
>
> -
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> 
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] debian install

2008-07-09 Thread Ben Axelrod
I get errors when I add:
  deb http://anakonda.altervista.org/debian packages/
  deb-src http://anakonda.altervista.org/debian sources/
to my /etc/apt/sources.list.  Is this still the preferred method for installing 
on Debian?

Thanks,
-Ben
-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Questions about 3D plotting

2008-07-09 Thread Darren Dale
On Wednesday 09 July 2008 12:40:29 pm anirudh vij wrote:
> > We have been warning that 3D plotting was unsupported and needed someone
> > to volunteer to maintain it for quite a while now. Nobody answered the
> > call, and 3d capabilities did not survive the transition to the new
> > transforms in mpl-0.98, so it was removed, However...
>
> hmm. Mayavi2 has a mlab module thats under active development. It aims
> to do the same stuff that matlab 3D plots do. However, svn currently
> crashes for me.
>
> > [...]
> >
> >> matplotlib version is 0.91.2, straight from ubuntu repos.
> >
> > 3D support should still be present in 0.91.x. I just did a clean install
> > of 0.91.4 from svn, and this works:
> >
> > import pylab as p
> > import matplotlib.axes3d as p3
> > fig=p.figure()
> > ax = p3.Axes3D(fig)
> > p.show()
> >
> > I haven't used matplotlib's 3d capabilities, so I dont know how you
> > expected to work with "from pylab import *" instead of the above. Perhaps
> > you could give a short explicit example of what used to work and now does
> > not.
>
> -
> from pylab import *
> import matplotlib.axes3d as p3
> fig=figure()
> ax= p3.Axes3D(fig)
> ax.scatter3D(x,y,z)
> show()
> -
> this causes an error. 

I can't help much if you don't tell me what the error is. I just ran the 
following and I did not observe any error:

from pylab import *
x=rand(100)
y=rand(100)
z=rand(100)
import matplotlib.axes3d as p3
fig=figure()
ax= p3.Axes3D(fig)
ax.scatter3D(x,y,z)
show()

> x,y,z are valid 1D arrays. They work using the 
> method you've posted in your mail.
>
> Perhaps a wrapper can be wriitten around mayavi's mlab module. 3D
> plotting is too important to leave out of something like matplotlib.
> Its perfect for all other things. It would be a pity if one has to
> switch to gnuplot or dislin just for 3D.

It sounds like a good idea to me. Submissions are very welcome.

Darren

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Questions about 3D plotting

2008-07-09 Thread anirudh vij
> We have been warning that 3D plotting was unsupported and needed someone to
> volunteer to maintain it for quite a while now. Nobody answered the call, and
> 3d capabilities did not survive the transition to the new transforms in
> mpl-0.98, so it was removed, However...
>

hmm. Mayavi2 has a mlab module thats under active development. It aims
to do the same stuff that matlab 3D plots do. However, svn currently
crashes for me.

> [...]
>> matplotlib version is 0.91.2, straight from ubuntu repos.
>
> 3D support should still be present in 0.91.x. I just did a clean install of
> 0.91.4 from svn, and this works:
>
> import pylab as p
> import matplotlib.axes3d as p3
> fig=p.figure()
> ax = p3.Axes3D(fig)
> p.show()
>
> I haven't used matplotlib's 3d capabilities, so I dont know how you expected
> to work with "from pylab import *" instead of the above. Perhaps you could
> give a short explicit example of what used to work and now does not.
-
from pylab import *
import matplotlib.axes3d as p3
fig=figure()
ax= p3.Axes3D(fig)
ax.scatter3D(x,y,z)
show()
-
this causes an error. x,y,z are valid 1D arrays. They work using the
method you've posted in your mail.

Perhaps a wrapper can be wriitten around mayavi's mlab module. 3D
plotting is too important to leave out of something like matplotlib.
Its perfect for all other things. It would be a pity if one has to
switch to gnuplot or dislin just for 3D.

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Questions about 3D plotting

2008-07-09 Thread Darren Dale
On Wednesday 09 July 2008 11:59:50 am anirudh vij wrote:
> On Wed, Jul 9, 2008 at 4:54 PM, Darren Dale <[EMAIL PROTECTED]> wrote:
> > On Wednesday 09 July 2008 10:35:55 am anirudh vij wrote:
> >> Hi,
> >>
> >> First off, I'd like to congratulate the devs who wrote the 3D plotting
> >> module. Its great and fits a lot of my plotting needs without
> >> resorting to vtk, mayavi etc.
> >>
> >> But I've had some issues with 3D plots
> >
> > I'm sorry to disappoint, but 3D plotting has been unsupported for a long
> > time and was recently removed from the mpl codebase.
>
> This is horrible. How do I do 3D plots now?
> Mayavi svn crashes when called from python.

We have been warning that 3D plotting was unsupported and needed someone to 
volunteer to maintain it for quite a while now. Nobody answered the call, and 
3d capabilities did not survive the transition to the new transforms in 
mpl-0.98, so it was removed, However...

[...]
> matplotlib version is 0.91.2, straight from ubuntu repos.

3D support should still be present in 0.91.x. I just did a clean install of 
0.91.4 from svn, and this works:

import pylab as p
import matplotlib.axes3d as p3
fig=p.figure()
ax = p3.Axes3D(fig)
p.show()

I haven't used matplotlib's 3d capabilities, so I dont know how you expected 
to work with "from pylab import *" instead of the above. Perhaps you could 
give a short explicit example of what used to work and now does not.

Darren

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Questions about 3D plotting

2008-07-09 Thread Darren Dale
On Wednesday 09 July 2008 10:35:55 am anirudh vij wrote:
> Hi,
>
> First off, I'd like to congratulate the devs who wrote the 3D plotting
> module. Its great and fits a lot of my plotting needs without
> resorting to vtk, mayavi etc.
>
> But I've had some issues with 3D plots

I'm sorry to disappoint, but 3D plotting has been unsupported for a long time 
and was recently removed from the mpl codebase.

> 1. If i do a
> 
> import pylab as p
> import matplotlib.axes3d as p3
> fig=p.figure()
> ax = p3.Axes3D(fig)
> ax.scatter3D(ravel(x),ravel(y),ravel(z))
> ax.set_xlabel('X')
> ax.set_ylabel('Y')
> ax.set_zlabel('Z')
> p.show()
> 
>
> then things work well.

probably because you have an old version of axes3d.py in your installation 
directory...

> But if I do an "from pylab import *",
> the plot command does'nt work. Any ideas?

... but pylab.py knows that we dropped 3d support so it doesnt try to import 
it anymore. 

Darren

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Questions about 3D plotting

2008-07-09 Thread anirudh vij
Hi,

First off, I'd like to congratulate the devs who wrote the 3D plotting
module. Its great and fits a lot of my plotting needs without
resorting to vtk, mayavi etc.

But I've had some issues with 3D plots

1. If i do a

import pylab as p
import matplotlib.axes3d as p3
fig=p.figure()
ax = p3.Axes3D(fig)
ax.scatter3D(ravel(x),ravel(y),ravel(z))
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
p.show()


then things work well.

But if I do an "from pylab import *",
the plot command does'nt work. Any ideas?

2. In the scatterplot, as well as other 3D plots, I would like to plot
different datasets with different colors. While in plot(), "r." etc
change color, in plot3d etc the option does'nt work.
So, is there a way to use different colors in the same plot.

3. Is there any documentation on the 3D plotting functions. There are
examples at http://scipy.org/Cookbook/Matplotlib/mplot3D, but I
could'nt find any documentation on function calls, options etc.
help(plot3d) just says plot3d(**args) without any other info.

cheers,
anirudh.

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] creating colormaps

2008-07-09 Thread Marjolaine Rouault
Hi,

I don't understand how one creates his own colormap. i am using matplotlib and 
I have checked the example in 
http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps but I can't really 
understand how it works. Are there any other examples out there? I want to 
create a colormap a bit like the one at this url:

http://www.pyngl.ucar.edu/Graphics/Images/ViBlGrWhYeOrRe.gif

best regards, Marjolaine.



-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.


-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Fwd: Re: Autonomous display of image/plot/figure

2008-07-09 Thread James K. Gruetzner
Thanks for the suggestion, Michael.   Reading it led to a bit of a forehead
slap.

Unfortunately, that didn't work either.  Curiously, it appears that
the "show()" command does not return.

- CODE SECTION -
#!/usr/local/bin/python

import os,sys
import pylab

def main():
  x = pylab.linspace(-10,10,100)
  y = pylab.sin(x)
  pylab.plot(x,y)
  sys.stderr.write("Begun.")
  pylab.show()
  sys.stderr.write("Done.")

if __name__ == "__main__":
  main()
 END CODE -

When executed from the command line:
$ ./test.py &
   . . . the plot displays; clicking on the X closes it, but the process keeps
on running.

When executed as an argument to python:
$ python test.py &
 . . . the same behavior (except it's a python process which hangs).

The two sys.stderr.write() statements are for debugging.  The first one
executes; the second does not.  My conclusion is that the show() command does
not return.

--
When I operate interactively,
  the command "pylab.plot(x,y)" opens a widow labeled "Figure 1".
 . . . then . . .
  the command "show()" writes the plot to that window (i.e., sine plot).

Clicking the X in the figure window causes the window to disappear, but
the "show()" command fails to return.

--

So . . . I figure that the lack of show() returning is the root problem.

Any suggestions?

 I'm running Fedora 8, python 2.5.1, and matplotlib 0.91.2-1.fc8  from the yum
repository.   Backend is set to GTKAgg in my matplotlibrc file.

  James

---

On Monday 07 July 2008 17:29:16 you wrote:
> Why do you want to "fork" the process?  If you just run it in the
> background it should have the desired effect:
>
> 
> from pylab import *
> x = linspace(-10,10,100) # or load data from a file.
> y = sin(x)
> plot(x,y)
> show()
> 
>
> $ python tst.py&
>
> Process remains in background running until the user closes the plot
> window, at which point it terminates.
>
> Michael.
>
> On 7 Jul 2008, at 2:30 PM, James K. Gruetzner wrote:
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> >
> > I'm not sure if this is the right venue for this question.  I've
> > searched the
> > archives, but without success so far.  If this is covered there (or
> > elsewhere
> > on the web), I'd apprciate a pointer to it so it doesn't duplicate
> > bandwidth
> > here.
> >
> > Anyway, what I'd like to do is have a python script which reads
> > data from a
> > file, displays an image/plot/whatever made from the data, and then
> > exits,
> > keeping the image displayed.
> >
> > I'm running Fedora 8, python 2.5.1, and matplotlib 0.91.2-1.fc8
> > from the yum
> > repository.   Backend is set to GTKAgg in my matplotlibrc file.
> >
> > My initial attempt used the "double fork" method from the python
> > cookbook:
> >
> > - -Code follows--
> >   if __name__ == "__main__":
> >
> >   #From Python Cookbook
> >   try:
> > pid = os.fork()
> > if pid > 0:
> >   # Exit first parent
> >   sys.exit(0)
> >   except OSError, e:
> > print >>sys.stderr, "fork #1 failed: %d (%s)" %(e.errno,
> > e.strerror)
> > sys.exit(1)
> >
> >   # Decouple from parent environment
> >   #os.chdir("/")
> >   os.setsid()
> >   os.umask(0)
> >
> >   # Do second fork
> >   try:
> > pid = os.fork()
> > if pid > 0:
> >   # Exit from second parent; print eventual PID before exiting
> >   print "Image PID %d" % pid
> >   sys.exit(0)
> >   except OSError, e:
> > print >>sys.stderr, "fork #2 failed:  %d (%s)"%(e.errno,
> > e.strerror)
> > sys.exit(1)
> >
> >   # Start the main loop to display image
> >   main()
> >
> > - --END CODE--
> >
> > The main() function reads the values appropriately into the
> > variable "myarr",
> > and then calls imshow and show:
> >
> > -  Code follows ---
> >
> >
> >   pylab.imshow(myarr)
> >   pylab.show()
> > - --END CODE--
> >
> > . . . and then exits.
> >
> > All works well until I try to kill the figure/image  by clicking on
> > the X in
> > the upper-right corner.   It disappears alright, but the process
> > remains
> > running, and I have to manually kill it with the kill -SIGTERM
> >  command.
> >
> > I'd like the process to die when I close the window.
> >
> > I'm really an application programmer, not a system programmer, and
> > usually
> > don't delve this deeply into process management, so I'm probably doing
> > something extremely ignorant.  Help is appreciated.
> >
> > Thanks!
> >
> >   James
> >
> >


---


-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/c

Re: [Matplotlib-users] Problem of memory for image buffer

2008-07-09 Thread Maxime Bois
Tahnk you for the link.

In fact, I don't know what's happen yesterday because I can't reproduce 
the error. I launch again my program and everything is good, I don't 
have the error anymore...

Cheers,
Maxime

Michael Droettboom a écrit :
> Have a look here for some information about memory leaks:
>
> http://matplotlib.sourceforge.net/faq.html#LEAKS
>
> Can you provide a small standalone script that reproduces the error?  
> It is possible that the figures are not being destroyed correctly 
> because an extra reference is being held to them or something of that 
> sort.
>
> Cheers,
> Mike
>
> Maxime Bois wrote:
>> Hi all,
>>
>> I have a problem of free memory for image buffer when I use 
>> Matplotlib (the last version on linux).
>> What i'm doing is that I create 4 figures  in the same time, I save 
>> my plots and I close them. After that, I create 4 new figures, save 
>> them and close them... I do that many times and after a moment, a 
>> problem occurs.
>> I obtain this message :   ": not enough 
>> free memory for image buffer"   and my program stops.
>>
>> Does anyone have a solution for this problem ?
>> Thanks a lot
>> M.
>>
>> - 
>>
>> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
>> Studies have shown that voting for your favorite open source project,
>> along with a healthy diet, reduces your potential for chronic lameness
>> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>   
>

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users