Re: [Matplotlib-users] contourf problem

2010-03-28 Thread Friedrich Romstedt
2010/3/29 Alan G Isaac : > Can you explain this: > norm = colors.Normalize(vmin = -1, vmax = 1) The normaliser takes some arbitrary value and returns a value in [0, 1]. Hence the name. The value \in [0, 1] is handed over to the cmap's __call__(), resulting in the color value. And yes, I guess y

[Matplotlib-users] colorbar.Colorbar ticking

2010-03-28 Thread Friedrich Romstedt
I noticed that colorbar.Colorbar treats segmentation via *boundaries* as compulsory, i.e., it thinks it must tick at the *boundaries* or nowhere. Wouldn't it be useful to have an kwarg which overrides this and always uses ticker.MaxNLocator()? Friedrich --

[Matplotlib-users] ticker.FixedLocator bug

2010-03-28 Thread Friedrich Romstedt
matplotlib.ticker:748: # ORIGINAL: # step = max(int(0.99 + len(self.locs) / float(self.nbins)), 1) step = int(math.ceil(len(self.locs) / (self.nbins + 1))) There is a from __future__ import division statement. Who verifies (or falsifies)? I checked with values len(locs)

Re: [Matplotlib-users] contourf problem

2010-03-28 Thread Alan G Isaac
On 3/28/2010 7:19 PM, Friedrich Romstedt wrote: > I fixed your problem Can you explain this: norm = colors.Normalize(vmin = -1, vmax = 1) I take it that this scales the range for the color bar, which is what 'luminance' must refer to in the docs? In which case, can we just set vmin and vmax as i

Re: [Matplotlib-users] strange behavior using a mask with Basemap

2010-03-28 Thread Eric Firing
Yeates, Mathew C (388D) wrote: > Hi > > I would expect > > hgt=ma.masked_where(div == 0,hgt) > > m.contourf(x,y,hgt,15,cmap=plt.cm.jet) > > > > to produce a map complementary to the map produced by > > > > hgt=ma.masked_where(div != 0,hgt) > > m.contourf(x,y,hgt,15,cmap=plt.cm.jet) > >

Re: [Matplotlib-users] Making a data-driven colormap

2010-03-28 Thread Friedrich Romstedt
2010/3/28 Chloe Lewis : > That would be a lot nicer, Friedrich; could you share demo code?  I can't > make the set_ylim work, but I think I'm being clumsy with the object model. It seems that I cannot read the sections following after the "From this:" and "I get this:"? But anyway, I solved it fo

[Matplotlib-users] Issues with imshow

2010-03-28 Thread Sunman
Hello, I am trying to use the imshow() function for a 2-dimensional array. However, I am having issues with the following: When the array is perfectly square the image looks like this: http://old.nabble.com/file/p28063442/Plot2.png but when it is not it looks like this: http://old.nabble.com/

Re: [Matplotlib-users] contourf problem

2010-03-28 Thread Friedrich Romstedt
2010/3/29 Alan G Isaac : > OK, it's obvious one you point it out. > Sorry for the typo in the example. > > Now suppose I want a colorbar labelled at -1, 0, 1 > but the highest value realized is <1. Can I somehow > use ticks=(-1,0,1) anyway, or do I have to tick at > the realized limits and then la

Re: [Matplotlib-users] contourf problem

2010-03-28 Thread Alan G Isaac
On 3/28/2010 3:04 PM, Ryan May wrote: > it's just using indices, which run from 0 to 99. Since the limits > are 0 to 100, bam...white space because, indeed, there is no data. > OK, it's obvious one you point it out. Sorry for the typo in the example. Now suppose I want a colorbar labelled at

Re: [Matplotlib-users] Making a data-driven colormap

2010-03-28 Thread Friedrich Romstedt
2010/3/28 Ariel Rokem : > Hi Chloe, > > _segmentdata - that's what I was looking for! Hmm, much easier would maybe be: colorbar = figure.colorbar(...) colorbar.ax.set_xlim((C.min(), C.max()) # Or .set_ylim() for vertical cbars. I just did a dive into the matplotlib code and docu: http://matplo

Re: [Matplotlib-users] Making a data-driven colormap

2010-03-28 Thread Ariel Rokem
Hi Chloe, _segmentdata - that's what I was looking for! Thanks a lot also for that bit of code! Cheers - Ariel On Sun, Mar 28, 2010 at 1:53 AM, Chloe Lewis wrote: > Like so, not that it couldn't be improved: > > import matplotlib.cm as cm > import matplotlib.colors as colors > import pylab

Re: [Matplotlib-users] Basemap white space

2010-03-28 Thread Friedrich Romstedt
2010/3/28 Filipe Pires Alvarenga Fernandes : > Hello list > I've trying for a while a "python only" solution to remove white spaces that > Basemap generate to keep the aspect ratio. I found these two threads that > explain the issue better: I think maybe you can make use of the Agg Backend to ach

Re: [Matplotlib-users] contourf problem

2010-03-28 Thread Ryan May
On Sun, Mar 28, 2010 at 11:16 AM, Alan G Isaac wrote: > Using contourf in version 0.99.1, > I'm seeing an unwanted white strip to > the top and right, adjacent to the axes. > (In fact, the strip looks just wide > enough to underlay the ticks.) > > Alan Isaac > > PS Simple example: > > x = np.linsp

[Matplotlib-users] contourf problem

2010-03-28 Thread Alan G Isaac
Using contourf in version 0.99.1, I'm seeing an unwanted white strip to the top and right, adjacent to the axes. (In fact, the strip looks just wide enough to underlay the ticks.) Alan Isaac PS Simple example: x = np.linspace(-5, 5, 100) X, Y = np.meshgrid(x, x) Z = np.sin(x*y[:,None]) fig = plt

[Matplotlib-users] plot_surface defaults?

2010-03-28 Thread Alan G Isaac
1. Sorry if I miss this in the docs, but what are the default values of rstride and cstride? It seems these automagically limit the amount of data used by the surface plot. 2. Also, what is the right way to set alpha for the surface? If I use an alpha keyword for plot_surface, I cannot seem to pu

Re: [Matplotlib-users] toolbar

2010-03-28 Thread Peter Butterworth
I've done a few minor enhancements and corrections to the qt4_editor (interactive plot options popup). Should I submit them to matplotlib or directly to the original author Pierre Raybaut ? What plot options do you think can be added to the qt4_editor ? I've added a basic Legend option to the Axes

Re: [Matplotlib-users] Overlapping labels in pie charts

2010-03-28 Thread Rune V . Sjøen
Hello again, and thanks. I did not have a chance to look at this until now but using arc instead of angle worked out great. 2010/3/24 Jae-Joon Lee > You should not use "angle" style if you change the x,y position (this > is due to the algorithm of how the line connecting two points are > create

Re: [Matplotlib-users] Making a data-driven colormap

2010-03-28 Thread Chloe Lewis
Like so, not that it couldn't be improved: import matplotlib.cm as cm import matplotlib.colors as colors import pylab as p def rgb_to_dict(value, cbar): return dict(zip(('red','green','blue','alpha'), cbar(value))) def subcolorbar(xmin, xmax, cbar): '''Returns the part of cbar between