Re: [Matplotlib-users] Basemap: Removing white space in savefig

2009-11-11 Thread Jeff Whitaker
On Tue, 10 Nov 2009 13:13 -0500, George Bonev george...@gmail.com wrote: Hello, I am plotting a fig in Basemap, but I don't need the extra while space on the sides of the figure when I use savfig(). I tried axes([0,0,1,1]) but that just gave me a blank white screen with some ticks on

[Matplotlib-users] function to create netcdf file

2009-11-11 Thread John [H2O]
Hello, I'm trying to write a function to create a 'vanilla' NetCDF file to which I can add data. So far I have created the following, which is designed to set up a netcdf file for the addition of global or at least lat/lon datasets. My question has to do with attribute setting. Is it valid to do

[Matplotlib-users] matplotlib slow compared to gnuplot?

2009-11-11 Thread Mike Anderson
Hi all, Previously I was a user of gnuplot but have been giving matplotlib a try. One thing I've run in to right away is that matplotlib appears to be significantly slower. A script to produce a dozen plots was taking me ~1 second with gnuplot, and now takes me ~18 seconds with

Re: [Matplotlib-users] function to create netcdf file

2009-11-11 Thread Ryan May
On Wed, Nov 11, 2009 at 7:31 AM, John [H2O] washa...@gmail.com wrote: Hello, I'm trying to write a function to create a 'vanilla' NetCDF file to which I can add data. So far I have created the following, which is designed to set up a netcdf file for the addition of global or at least lat/lon

Re: [Matplotlib-users] function to create netcdf file

2009-11-11 Thread John
No problem.. just wanted to make sure it would work and is 'pythonic'. I guess the biggest concern is that for others using the netcdf file, say from matlab or somewhere else, will be able to access the attributes. It seemed so easy to do it this way, I was curious why the tutorials suggest

Re: [Matplotlib-users] function to create netcdf file

2009-11-11 Thread Ryan May
On Wed, Nov 11, 2009 at 9:26 AM, John washa...@gmail.com wrote: No problem.. just wanted to make sure it would work and is 'pythonic'. I guess the biggest concern is that for others using the netcdf file, say from matlab or somewhere else, will be able to access the attributes. It seemed so

Re: [Matplotlib-users] function to create netcdf file

2009-11-11 Thread John
It's actually just a nice part of the python language, setattr(a, 'foo', 'bar') is the same code as a.foo = bar. When working with NetCDF, the only time I've needed to use setarr (or getattr) is when the name of the attribute I want isn't a valid python identifier (like if an attribute has a

[Matplotlib-users] differnet colormaps with pcolormesh

2009-11-11 Thread Christian Meesters
Hi, Is there a way to somehow squeeze two datasets with two different color maps into one pcolormesh? Say one dataset occupies one triangle (e. g. numpy.triu(dataset1, 1)) and the second dataset a different area (e. g. numpy.tril(dataset2, -1)) and then paste the two datasets in one pcolormesh

[Matplotlib-users] contoured slice in 3D scatterplot

2009-11-11 Thread Claus
Hi, I'm running matplotlib v 0.99.0. I can create a 3D scatterplot, like this: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = Axes3D(fig) ax.scatter( ... ) so far so good. Now, say I want to add a 2D contourplot (a slice of the 3D scatter

[Matplotlib-users] parsing tab separated files into dictionaries - alternative to genfromtxt?

2009-11-11 Thread per freem
hi all, i've been using genfromtxt to parse tab separated files for plotting purposes in matplotlib. the problem is that genfromtxt seems to give only two ways to access the contents of the file: one is by column, where you can use: d = genfromtxt(...) and then do d['header_name1'] to access

Re: [Matplotlib-users] parsing tab separated files into dictionaries - alternative to genfromtxt?

2009-11-11 Thread Mike Anderson
ideally what i would like is to be able to traverse each line of the parsed file, and then refer to each of its fields by header name, so that if the column order in the file changes my program will be unaffected: What you want is a DictReader. For a quick example of me using that,

Re: [Matplotlib-users] [Numpy-discussion] parsing tab separated files into dictionaries - alternative to genfromtxt?

2009-11-11 Thread Gökhan Sever
On Wed, Nov 11, 2009 at 11:53 AM, per freem perfr...@gmail.com wrote: hi all, i've been using genfromtxt to parse tab separated files for plotting purposes in matplotlib. the problem is that genfromtxt seems to give only two ways to access the contents of the file: one is by column, where

[Matplotlib-users] overriding Collections.get_transform weirdness

2009-11-11 Thread Tony S Yu
Hi, Awhile back, Jae-Joon helped me transform collection sizes from points to data values by overriding the `get_transform` method of a RegularPolyCollection (see example code below). When I tried the code today, the collection didn't appear on the plot. Removing the get_transform method

Re: [Matplotlib-users] overriding Collections.get_transform weirdness

2009-11-11 Thread Michael Droettboom
Which older revision (or release) worked as you expected? Mike Tony S Yu wrote: Hi, Awhile back, Jae-Joon helped me transform collection sizes from points to data values by overriding the `get_transform` method of a RegularPolyCollection (see example code below). When I tried the code

Re: [Matplotlib-users] matplotlib slow compared to gnuplot?

2009-11-11 Thread Tom Leys
It looks like you are storing your source data in a python list. Matplotlib runs much faster if you store your data using a numpy array instead. I'm no expert, but it certianly sped up my graph drawing. -Tom Message: 5 Date: Wed, 11 Nov 2009 08:53:58 -0600 From: Mike Anderson

Re: [Matplotlib-users] overriding Collections.get_transform weirdness

2009-11-11 Thread Tony S Yu
On Nov 11, 2009, at 1:33 PM, Michael Droettboom wrote: Which older revision (or release) worked as you expected? After some digging, I think this issue is caused by an error in the macosx backend (everything works fine with tkagg, qt4agg, and agg). Oddly enough, calling savefig(), instead

[Matplotlib-users] Unwanted lines between contourf() contour levels

2009-11-11 Thread Ryan Neve
Hello, In my filled contour plot: http://imgur.com/vXoCL.png There are faint lines between the contour levels. I think they are yellow since they disappear in the yellow parts of the graph and are most obvious in the red areas. Is there any way to get rid of these lines? The number of contour

Re: [Matplotlib-users] Noob confusion: Pcolor

2009-11-11 Thread Shrividya Ravi
Thanks for your reply, Giorgio. I had a look at the documentation for pcolor but unfortunately, I can't pick out where I have gone wrong. I have attached my data array as a txt file. In ipython, I use the 'loadtxt' command to load the dataset and then assigned the variables x,y, and z to the

Re: [Matplotlib-users] Noob confusion: Pcolor

2009-11-11 Thread John Hunter
On Wed, Nov 11, 2009 at 3:22 PM, Shrividya Ravi penthesel...@gmail.com wrote: Thanks for your reply, Giorgio. I had a look at the documentation for pcolor but unfortunately, I can't pick out where I have gone wrong. I have attached my data array as a txt file. In ipython, I use the 'loadtxt'

Re: [Matplotlib-users] Unwanted lines between contourf() contour levels

2009-11-11 Thread Eric Firing
Ryan Neve wrote: Hello, In my filled contour plot: http://imgur.com/vXoCL.png There are faint lines between the contour levels. I think they are yellow since they disappear in the yellow parts of the graph and are most obvious in the red areas. Is there any way to get rid of these lines?

Re: [Matplotlib-users] Noob confusion: Pcolor

2009-11-11 Thread Pauli Virtanen
Tue, 10 Nov 2009 23:45:10 -0800, shriv wrote: I am a very new user to both python and matplotlib so please beware that my questions might be a real no-brainer. Here goes: I have a 3D array of data that I isolated from a much larger dataset. The first two columns are the x and y positions while

Re: [Matplotlib-users] differnet colormaps with pcolormesh

2009-11-11 Thread Jae-Joon Lee
I'm not exactly sure what you're trying to do. but I think what you want can be easily achieved by simply using the masked array. Is the example below similar to what you need? a = np.arange(100).reshape((10,10)) m1 = np.triu(a, 1) 0 m2 = np.tril(a, -1) 0 #m2 = ~m1 am1 = np.ma.array(a,

Re: [Matplotlib-users] bug in set_yscale of bar graphs?

2009-11-11 Thread Jae-Joon Lee
The bar command makes rectangles whose bottom position is 0. The reason that bars disappear when you set log scale is that bottom position of the bar become -infinity. You may * set log scale before calling the bar or * create bar plot but with reasonable (positive) bottom value. Take a look

Re: [Matplotlib-users] bug in set_yscale of bar graphs?

2009-11-11 Thread Gökhan Sever
On Wed, Nov 11, 2009 at 4:25 PM, per freem perfr...@gmail.com wrote: hi all, I am trying to make a simple bar graph that has its yaxis scale set to log.  I use the following code: import matplotlib matplotlib.use('PDF') import matplotlib.pyplot as plt from matplotlib import rc

[Matplotlib-users] matplotlib with Qt4 backend

2009-11-11 Thread Celil Rufat
I just installed matplotlib on Snow Leopard 10.6 with the Qt4 backend (via macports). However, when I try one of the Qt4 examles: python /opt/local/share/py26-matplotlib/examples/user_interfaces/embedding_in_qt4.py I get the following error message: Traceback (most recent call last): File

[Matplotlib-users] Strange event errors with WXAgg + wx

2009-11-11 Thread Taro Sato
Hello. I'm trying to embed mpl in an wxpython app which is intended to run repeatedly within a single script. (It's a workaround for not being able to use pyplot.show() more than once in a script.) All seems to work as intended when I don't attach any key press events (here to just destroy the