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

2010-03-29 Thread Ariel Rokem
Hi -

I ended up with the code below, using Chloe's previously posted
'subcolormap' and, in order to make the colorbar nicely attached to the main
imshow plot, I use make_axes_locatable in order to generate the colorbar
axes. I tried it out with a couple of use-cases and it seems to do what it
is supposed to, (with ticks only for the edges of the range of the data and
0, if that is within that range), but I am not entirely sure. Do you think
it works?


Cheers,

Ariel

from mpl_toolkits.axes_grid import make_axes_locatable

fig=plt.figure()
ax_im = fig.add_subplot(1,1,1)
divider = make_axes_locatable(ax_im)
ax_cb = divider.new_vertical(size="20%", pad=0.2, pack_start=True)
fig.add_axes(ax_cb)
#Extract the minimum and maximum values for scaling of the
colormap/colorbar:
max_val = np.max(m[np.where(m<1)])
min_val = np.min(m)

#This makes sure that 0 is always the center of the colormap:
if min_val<-max_val:
ax_max = -min_val
ax_min = min_val
else:
ax_max = max_val
ax_min = -max_val

#Keyword args to imshow:
kw = {'origin': 'upper',
  'interpolation': 'nearest',
  'cmap':cmap,
  'vmin':ax_min,
  'vmax':ax_max}

im=ax_im.imshow(m,**kw)

#The following produces the colorbar and sets the ticks
if colorbar:
delta = ax_max-ax_min #The size of the entire interval of data
min_p = (min_val-ax_min)/delta
max_p = (max_val-ax_min)/delta
print min_p
print max_p
cnorm = mpl.colors.Normalize(vmin=min_val,vmax=max_val)
subcmap = subcolormap(min_p,max_p,cmap)
cb = mpl.colorbar.ColorbarBase(ax_cb, cmap=subcmap,
   orientation='horizontal',norm=cnorm)

#Set the ticks - if 0 is in the interval of values, set that, as
well
#as the maximal and minimal values:
if min_val<0:
cb.set_ticks([min_val,0,max_val])
cb.set_ticklabels(['%.2f'%min_val,'0','%.2f'%max_val])
#Otherwise - only set the minimal and maximal value:
else:
cb.set_ticks([min_val,max_val])
cb.set_ticklabels(['%.2f'%min_val,'%.2f'%max_val])



On Mon, Mar 29, 2010 at 6:41 AM, Friedrich Romstedt <
friedrichromst...@gmail.com> wrote:

> 2010/3/29 Friedrich Romstedt :
> > Note that the ticking is a bit weird, there is also a bug in
> > matplotlib I will report on right after this e-mail, whose bugfix you
> > will maybe want to apply to get ticking properly working.  When you
> > have insane values for C.min() and C.max() anyway, I'm afraid you have
> > to retick manually with *ticks* to colorbar().  The ticker.MaxNLocator
> > is only used when not using the *boundaries* arg to colorbar(),
> > unfortunately.  Otherwise it tries to create maximal many and less
> > than 11 ticks by using the lowest value and an appropriate step in
> > *boundaries*.  I think the implementation of ticking is cumbersome and
> > never optimal.
>
> You can get rid of this night mare by giving the kwarg "ticks =
> matplotlib.ticker.MaxNLocator()" to fig.colorbar().  Then the
> *boundaries* aren't used for ticking (but still for plotting).
>
> Friedrich
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] simple example using Basemap in a gtk app??

2010-03-29 Thread Mathew Yeates
Solved. Sort of. If I run using python it works. It fails if I run using
ipython with --pylab.

On Mon, Mar 29, 2010 at 3:46 PM, Mathew Yeates  wrote:

> I don't understand why the following fails.
>
> fig = Figure(figsize=(5,5), dpi=100)
> canvas = FigureCanvas(fig)
> ax = fig.add_subplot(111)
> m = Basemap(resolution='c',projection='cyl',lon_0=0,ax=ax)
> m.drawcoastlines(color='gray',ax=ax)
>
> fails with
> mpl_toolkits\basemap\__init__.pyc in set_axes_limits 
>2531 if is_interactive():
>2532 figManager = _pylab_helpers.Gcf.get_active()
> -> 2533 figManager.canvas.draw()
>
> AttributeError: 'NoneType' object has no attribute 'canvas'
>
> Why isn't my figure being set as active??
>
> Mathew
>
>
>
>
>
>
>
>
> On Mon, Mar 29, 2010 at 11:12 AM, Yeates, Mathew C (388D) <
> mathew.c.yea...@jpl.nasa.gov> wrote:
>
>>  Hi
>>
>> Anyone have an example? I found some older examples which no longer work.
>>
>>
>>
>> TIA
>>
>>
>>
>> Mathew
>>
>>
>>
>> For grins …. The following does not work. I’ve tried many different
>> variations …
>>
>>
>>
>> import matplotlib.pyplot as plt
>>
>>
>>
>> import gtk
>>
>> from mpl_toolkits.basemap import Basemap
>>
>> import matplotlib
>>
>> from matplotlib.figure import Figure
>>
>> fig=plt.Figure()
>>
>> ax=fig.add_subplot(111)
>>
>> m = Basemap(llcrnrlon=1, \
>>
>> llcrnrlat=40.6, \
>>
>> urcrnrlon=8.8, \
>>
>> urcrnrlat = 49.6, \
>>
>> projection = 'tmerc', \
>>
>> lon_0 = 4.9, \
>>
>> lat_0 = 45.1,ax=ax)
>>
>>
>>
>> from matplotlib.backends.backend_gtkagg import \
>>
>> FigureCanvasGTKAgg as FigureCanvas
>>
>> canvas = FigureCanvas(fig)
>>
>> m.drawcoastlines(color='gray')
>>
>> m.drawcountries(color='gray')
>>
>> m.fillcontinents(color='beige')
>>
>> builder = gtk.Builder()
>>
>> builder.add_from_file("fluxtool.glade")
>>
>> window1=builder.get_object("window1")
>>
>> window1.connect("destroy", lambda x: gtk.main_quit())
>>
>>
>>
>>
>>
>> vbox=builder.get_object("vbox1")
>>
>> vbox.pack_start(canvas)
>>
>> window1.show()
>>
>> gtk.main()
>>
>>
>>
>>
>> --
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] simple example using Basemap in a gtk app??

2010-03-29 Thread Mathew Yeates
I don't understand why the following fails.

fig = Figure(figsize=(5,5), dpi=100)
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
m = Basemap(resolution='c',projection='cyl',lon_0=0,ax=ax)
m.drawcoastlines(color='gray',ax=ax)

fails with
mpl_toolkits\basemap\__init__.pyc in set_axes_limits 
   2531 if is_interactive():
   2532 figManager = _pylab_helpers.Gcf.get_active()
-> 2533 figManager.canvas.draw()

AttributeError: 'NoneType' object has no attribute 'canvas'

Why isn't my figure being set as active??

Mathew








On Mon, Mar 29, 2010 at 11:12 AM, Yeates, Mathew C (388D) <
mathew.c.yea...@jpl.nasa.gov> wrote:

>  Hi
>
> Anyone have an example? I found some older examples which no longer work.
>
>
>
> TIA
>
>
>
> Mathew
>
>
>
> For grins …. The following does not work. I’ve tried many different
> variations …
>
>
>
> import matplotlib.pyplot as plt
>
>
>
> import gtk
>
> from mpl_toolkits.basemap import Basemap
>
> import matplotlib
>
> from matplotlib.figure import Figure
>
> fig=plt.Figure()
>
> ax=fig.add_subplot(111)
>
> m = Basemap(llcrnrlon=1, \
>
> llcrnrlat=40.6, \
>
> urcrnrlon=8.8, \
>
> urcrnrlat = 49.6, \
>
> projection = 'tmerc', \
>
> lon_0 = 4.9, \
>
> lat_0 = 45.1,ax=ax)
>
>
>
> from matplotlib.backends.backend_gtkagg import \
>
> FigureCanvasGTKAgg as FigureCanvas
>
> canvas = FigureCanvas(fig)
>
> m.drawcoastlines(color='gray')
>
> m.drawcountries(color='gray')
>
> m.fillcontinents(color='beige')
>
> builder = gtk.Builder()
>
> builder.add_from_file("fluxtool.glade")
>
> window1=builder.get_object("window1")
>
> window1.connect("destroy", lambda x: gtk.main_quit())
>
>
>
>
>
> vbox=builder.get_object("vbox1")
>
> vbox.pack_start(canvas)
>
> window1.show()
>
> gtk.main()
>
>
>
>
> --
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Is scatter method's linestyles keyword argument being ignored (in SVN)?

2010-03-29 Thread Eric Firing
Sami-Matias Niemi wrote:
> Hi,
> 
> When using scatter plotting method and linestyles argument the output  
> seems to ignore the linestyles keyword value at least in SVN. Can  
> someone confirm this or did I misunderstood the functionality?

Yes, scatter is designed to plot markers only, and it does ignore the 
linestyles kw.

> 
> I am trying to make a plot where the colour of the line changes as a  
> function of data value, but I don't want that each point (marker) is  
> plotted separately, but that the colour changes smoothly. I believe  
> scatter method could be used when optional arguments "c = values" and  
> linestyles = 'solid' are used. However, independent what the  
> linestyles argument value is, I always get the markers plotted and no  
> line appears.

We don't have anything that gives this behavior directly, but it can be 
simulated with a LineCollection.  See 
http://www.scipy.org/Cookbook/Matplotlib/MulticoloredLine.

Eric

> 
> 
> Cheers,
> Sami
> 
> 
> Example code (markers, but no solid line!?):
> 
> import numpy as np
> import pylab as p
> 
> data = np.arange(10)
> 
> p.scatter(data, data, c = data, s = data*10, linestyles = 'solid')
> 
> 
> 
> --
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] simple example using Basemap in a gtk app??

2010-03-29 Thread Yeates, Mathew C (388D)
Hi
Anyone have an example? I found some older examples which no longer work.

TIA

Mathew

For grins  The following does not work. I've tried many different 
variations ...

import matplotlib.pyplot as plt

import gtk
from mpl_toolkits.basemap import Basemap
import matplotlib
from matplotlib.figure import Figure
fig=plt.Figure()
ax=fig.add_subplot(111)
m = Basemap(llcrnrlon=1, \
llcrnrlat=40.6, \
urcrnrlon=8.8, \
urcrnrlat = 49.6, \
projection = 'tmerc', \
lon_0 = 4.9, \
lat_0 = 45.1,ax=ax)

from matplotlib.backends.backend_gtkagg import \
FigureCanvasGTKAgg as FigureCanvas
canvas = FigureCanvas(fig)
m.drawcoastlines(color='gray')
m.drawcountries(color='gray')
m.fillcontinents(color='beige')
builder = gtk.Builder()
builder.add_from_file("fluxtool.glade")
window1=builder.get_object("window1")
window1.connect("destroy", lambda x: gtk.main_quit())


vbox=builder.get_object("vbox1")
vbox.pack_start(canvas)
window1.show()
gtk.main()

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Is scatter method's linestyles keyword argument being ignored (in SVN)?

2010-03-29 Thread Sami-Matias Niemi
Hi,

When using scatter plotting method and linestyles argument the output  
seems to ignore the linestyles keyword value at least in SVN. Can  
someone confirm this or did I misunderstood the functionality?

I am trying to make a plot where the colour of the line changes as a  
function of data value, but I don't want that each point (marker) is  
plotted separately, but that the colour changes smoothly. I believe  
scatter method could be used when optional arguments "c = values" and  
linestyles = 'solid' are used. However, independent what the  
linestyles argument value is, I always get the markers plotted and no  
line appears.


Cheers,
Sami


Example code (markers, but no solid line!?):

import numpy as np
import pylab as p

data = np.arange(10)

p.scatter(data, data, c = data, s = data*10, linestyles = 'solid')



--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Copying collections over to a new figure

2010-03-29 Thread Thomas Robitaille
Hi Jae-Joon,

Thanks for your quick reply! Since for example LineCollections can be created 
independent of the Axes in which they are going to be plotted through the 
creation of a LineCollection instance, would it not be possible to have a 
method that allows one to retrieve an Axes-independent LineCollection from an 
Axes instance? (for example a get_collection method) This would then allow one 
to 'recycle' existing collections.

Cheers,

Thomas

On Mar 29, 2010, at 1:40 PM, Jae-Joon Lee wrote:

> As far as I can say, moving around artists from one axes to the other
> is NOT recommended. And I encourage you to create separate artists for
> each axes rather than try to reuse the existing ones.
> 
> For your particular example,
> 
> fig = mpl.figure()
> ax2 = fig.add_subplot(1,1,1)
> for c in ax1.collections:
>c._transOffset=ax2.transData
>ax2.add_collection(c)
> 
> should work.
> 
> Regards,
> 
> -JJ
> 
> 
> 
> 
> On Mon, Mar 29, 2010 at 12:24 PM, Thomas Robitaille
>  wrote:
>> Hello,
>> 
>> In the following example, I am trying to copy over existing collections from 
>> one plot to another:
>> 
>> import matplotlib.pyplot as mpl
>> 
>> fig = mpl.figure()
>> ax1 = fig.add_subplot(1,1,1)
>> ax1.scatter([0.5],[0.5])
>> fig.savefig('test1.png')
>> 
>> fig = mpl.figure()
>> ax2 = fig.add_subplot(1,1,1)
>> for c in ax1.collections:
>>ax2.add_collection(c)
>> fig.savefig('test2.png')
>> 
>> However, the circle appears in the wrong place in test2.png (close to 0.4, 
>> 0.4 instead of 0.5,0.5). Is it not possible/safe to copy over collections in 
>> this way? If not, then how should this be done?
>> 
>> Thanks,
>> 
>> Thomas
>> --
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> 


--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] problem with minorticks

2010-03-29 Thread yogesh karpate
Dear All,
 I want to make minor ticks working in following program.
Here only major ticks are dis[played in grpah though i have declared the
minor ticks
minorticks_on() doesnt work in my code. How to fix that.Please help me
out.Thanks in advance '
Regards
Yogesh

from numpy import *
from scipy import *
from scipy import signal, misc
import sys,time,os,gc
import matplotlib
import matplotlib.pyplot as plt
from numpy.random import *
from pylab import plot, show, ylim, yticks,xlim
from pylab import *
x=loadtxt('/home/jaguar/Desktop/45.txt')
x=x[0:1399]
y=arange(len(x))
plt.figure(2)
plt.plot(y,x,'k-')
#minorticks_on()
grid(True)#, color="r", ls="-")
gca().xaxis.grid(True, which="minor", color="r")
#gca().yaxis.grid(True, which='minor')
#grid(True, which="minor", color="r")

show()#l
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Copying collections over to a new figure

2010-03-29 Thread Jae-Joon Lee
As far as I can say, moving around artists from one axes to the other
is NOT recommended. And I encourage you to create separate artists for
each axes rather than try to reuse the existing ones.

For your particular example,

fig = mpl.figure()
ax2 = fig.add_subplot(1,1,1)
for c in ax1.collections:
c._transOffset=ax2.transData
ax2.add_collection(c)

should work.

Regards,

-JJ




On Mon, Mar 29, 2010 at 12:24 PM, Thomas Robitaille
 wrote:
> Hello,
>
> In the following example, I am trying to copy over existing collections from 
> one plot to another:
>
> import matplotlib.pyplot as mpl
>
> fig = mpl.figure()
> ax1 = fig.add_subplot(1,1,1)
> ax1.scatter([0.5],[0.5])
> fig.savefig('test1.png')
>
> fig = mpl.figure()
> ax2 = fig.add_subplot(1,1,1)
> for c in ax1.collections:
>    ax2.add_collection(c)
> fig.savefig('test2.png')
>
> However, the circle appears in the wrong place in test2.png (close to 0.4, 
> 0.4 instead of 0.5,0.5). Is it not possible/safe to copy over collections in 
> this way? If not, then how should this be done?
>
> Thanks,
>
> Thomas
> --
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Copying collections over to a new figure

2010-03-29 Thread Thomas Robitaille
Hello,

In the following example, I am trying to copy over existing collections from 
one plot to another:

import matplotlib.pyplot as mpl

fig = mpl.figure()
ax1 = fig.add_subplot(1,1,1)
ax1.scatter([0.5],[0.5])
fig.savefig('test1.png')

fig = mpl.figure()
ax2 = fig.add_subplot(1,1,1)
for c in ax1.collections:
ax2.add_collection(c)
fig.savefig('test2.png')

However, the circle appears in the wrong place in test2.png (close to 0.4, 0.4 
instead of 0.5,0.5). Is it not possible/safe to copy over collections in this 
way? If not, then how should this be done?

Thanks,

Thomas
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matshow / imshow with date-axis

2010-03-29 Thread Atomfried

Hi Matthias,

Thanks for the help. The problem is, however, that the 'extent' parameter
only manipulates the range of the (integer) values on the axis. Before
setting the *axis_date property, I need to set the axes data to arrays of
(non-equidistant) floats.

Best Regards,
Micha


Matthias Michler wrote:
> 
> 
> Did you already set the date-xaxis by hand?
> -> for axes 'ax' using e.g.
> ax.xaxis_date(tz=None)
> ax.yaxis_date(tz=None)
> 
> 

-- 
View this message in context: 
http://old.nabble.com/matshow---imshow-with-date-axis-tp28068228p28070890.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matshow / imshow with date-axis

2010-03-29 Thread Matthias Michler
On Monday 29 March 2010 13:56:51 Atomfried wrote:
> Hi,
>
> is it possible to perform a surface plot a NxM matrix with date-axes?
> Similar to plot_date for 1D-Plots. The dates are available as an N-sized
> (or M-sized) array of float values.
>
> At the moment, I am using imshow or matshow for the color plots, but the
> only way I found to manipulate the axes is the 'extent' keyword argument,
> which is not sufficient in this context.
>
> Any hints?
>
> Micha

Hi Micha,

Did you already set the date-xaxis by hand?
-> for axes 'ax' using e.g.
ax.xaxis_date(tz=None)
ax.yaxis_date(tz=None)

I would hope that extent and this together yield your aim, but I'm not so 
familiar with date-axes. 

Kind regards,
Mattthias

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colorbar.Colorbar ticking

2010-03-29 Thread Eric Firing
Friedrich Romstedt wrote:
> 2010/3/29 Eric Firing :
>> It already has this.  You can pass in a custom locator or set of tick
>> locations via the "ticks" kwarg, but if you don't, a locator is chosen
>> automatically.  Except in special cases, this will be a MaxNLocator. See the
>> ColorbarBase._ticker method.
> 
> Ah, thanks, It escaped my notice that there is a toplevel "if
> self.locator is None:" statement ... ok.
> 
>> Ah, maybe what you mean is a text option to the "ticks" kwarg that would
>> specify MaxNLocator without requiring one to instantiate a MaxNLocator? I
>> don't think this makes sense for the case when boundaries are specified
>> explicitly.
> 
> No, what I intended is exactly what you pointed out.
> 
> Btw, can you tell me what the *values* kwarg's semantic is?  I guess,
> it shall be the center values of the values displayed, but then the
> implementation for this in ColorbarBase._process_values() would be
> broken.

The ColorbarBase simply makes a strip of colored blocks, with their 
sizes and locations determined by the boundaries kwarg (together with 
the "spacing" kwarg) and their colors determined from the values kwarg 
via color mapping.  If either or both of these kwargs is None, the 
boundaries and/or values will be generated  in _process_values.  The use 
of the non-default values kwarg is illustrated by the special-case 
handling of colorbars for contouring in the Colorbar class.

Can you give a test case showing a problem with _process_values?

> 
> Friedrich
> 
> P.S.: I assume you have be caught by the "misconfiguration" of the
> list that the sender is used as the default recipient, so I post back
> to the list?

The mpl lists have been unusual (at least compared to lists for numpy, 
scipy, and cython) in this respect for years.  Usually I remember to 
reply to all, but you are right--this time I goofed.

Eric

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


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

2010-03-29 Thread Friedrich Romstedt
2010/3/29 Friedrich Romstedt :
> Note that the ticking is a bit weird, there is also a bug in
> matplotlib I will report on right after this e-mail, whose bugfix you
> will maybe want to apply to get ticking properly working.  When you
> have insane values for C.min() and C.max() anyway, I'm afraid you have
> to retick manually with *ticks* to colorbar().  The ticker.MaxNLocator
> is only used when not using the *boundaries* arg to colorbar(),
> unfortunately.  Otherwise it tries to create maximal many and less
> than 11 ticks by using the lowest value and an appropriate step in
> *boundaries*.  I think the implementation of ticking is cumbersome and
> never optimal.

You can get rid of this night mare by giving the kwarg "ticks =
matplotlib.ticker.MaxNLocator()" to fig.colorbar().  Then the
*boundaries* aren't used for ticking (but still for plotting).

Friedrich

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] MacOS 10.6 install dependency building fails (r8214)

2010-03-29 Thread Thomas Robitaille
Hello,

It looks like the zlib website removes previous version of its library that 
were previously available for download, so the part in make.osx where 
http://www.zlib.net/zlib-1.2.3.tar.gz is fetched now fails (since the current 
version is 1.2.4). The error in the matplotlib building is not explicit enough 
(incorrect archive type) - maybe one could catch such 404s and print out an 
error suggesting to increase the ZLIBVERSION variable?

I tried changing ZLIBVERSION to 1.2.4 and the following occurs when building 
zlib:

...
gcc -arch i386 -arch x86_64 -I/Users/tom/install/include 
-I/Users/tom/install/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk 
  -c -o inftrees.o inftrees.c
gcc -arch i386 -arch x86_64 -I/Users/tom/install/include 
-I/Users/tom/install/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk 
  -c -o trees.o trees.c
gcc -arch i386 -arch x86_64 -I/Users/tom/install/include 
-I/Users/tom/install/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk 
  -c -o uncompr.o uncompr.c
gcc -arch i386 -arch x86_64 -I/Users/tom/install/include 
-I/Users/tom/install/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk 
  -c -o zutil.o zutil.c
make[1]: *** No rule to make target `libz.dylib', needed by `install-libs'.  
Stop.
make[1]: *** Waiting for unfinished jobs
make: *** [zlib] Error 2

If I manually go to the zlib directory and type make, it builds without a 
problem, so it looks like there is some kind of problem in the make.osx script.

Thanks in advance for any help,

Thomas
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colorbar.Colorbar ticking

2010-03-29 Thread Friedrich Romstedt
2010/3/29 Eric Firing :
> It already has this.  You can pass in a custom locator or set of tick
> locations via the "ticks" kwarg, but if you don't, a locator is chosen
> automatically.  Except in special cases, this will be a MaxNLocator. See the
> ColorbarBase._ticker method.

Ah, thanks, It escaped my notice that there is a toplevel "if
self.locator is None:" statement ... ok.

> Ah, maybe what you mean is a text option to the "ticks" kwarg that would
> specify MaxNLocator without requiring one to instantiate a MaxNLocator? I
> don't think this makes sense for the case when boundaries are specified
> explicitly.

No, what I intended is exactly what you pointed out.

Btw, can you tell me what the *values* kwarg's semantic is?  I guess,
it shall be the center values of the values displayed, but then the
implementation for this in ColorbarBase._process_values() would be
broken.

Friedrich

P.S.: I assume you have be caught by the "misconfiguration" of the
list that the sender is used as the default recipient, so I post back
to the list?

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


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

2010-03-29 Thread Atomfried

I once had a similar issue. I solved it like this. It takes the minimum and
maximum of the data and returns a colormap: Zero: White, Positive values:
blue, Negative values: red.

def mxcmap(_min,_max):
if _min >= 0 and _max >= 0:
cdict = {'red': ((0.0, 1.0, 1.0),
(1.0, 0.0, 0.0)),
'green': ((0.0, 1.0, 1.0),
(1.0, 0.0, 0.0)),
'blue': ((0.0, 1.0, 1.0),
(1.0, 1.0, 1.0))}
elif _min <= 0 and _max <= 0:
cdict = {'red': ((0.0, 1.0, 1.0),
(1.0, 1.0, 1.0)),
'green': ((0.0, 0.0, 0.0),
(1.0, 1.0, 1.0)),
'blue': ((0.0, 0.0, 0.0),
(1.0, 1.0, 1.0))}
else:
full_red = 1
full_blue = 1
if -_min > _max:
full_blue = -float(_max)/_min
else:
full_red = -float(_min)/_max
zero = 0.5-((_max+_min)/2.)/(_max-_min)

cdict = {'red': ((0.0, 1.0, 1.0),
(zero, 1.0, 1.0),
(1.0, 1-full_blue, 1-full_blue)),
'green': ((0.0, 1-full_red, 1-full_red),
(zero, 1.0, 1.0),
(1.0, 1-full_blue, 1-full_blue)),
'blue': ((0.0, 1-full_red, 1-full_red),
(zero,1.0, 1.0),
(1.0, 1.0, 1.0))}
return
pylab.matplotlib.colors.LinearSegmentedColormap('my_colormap',cdict,256)
-- 
View this message in context: 
http://old.nabble.com/Making-a-data-driven-colormap-tp28050311p28067995.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] matshow / imshow with date-axis

2010-03-29 Thread Atomfried

Hi,

is it possible to perform a surface plot a NxM matrix with date-axes?
Similar to plot_date for 1D-Plots. The dates are available as an N-sized (or
M-sized) array of float values.

At the moment, I am using imshow or matshow for the color plots, but the
only way I found to manipulate the axes is the 'extent' keyword argument,
which is not sufficient in this context.

Any hints?

Micha
-- 
View this message in context: 
http://old.nabble.com/matshow---imshow-with-date-axis-tp28068228p28068228.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Issues with imshow

2010-03-29 Thread Matthias Michler
On Monday 29 March 2010 01:51:30 Sunman wrote:
> 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/file/p28063442/Plot.png
>
> Is there any way I can line up the image for a rectangular array so that
> its in the top left corner?

Hi,

I'm not really sure I get your point, but you can try to play with the 
placement of the used subplot 
``axes(rect)`` where *rect* = [left, bottom, width, height] 
 in normalized (0, 1) units.
e.g.
ax = plt.axes([0.1, 0.2, 0.8, 0.6])

and with the kwargs of imshow (extent: limits of the picture and aspect : [ 
None | 'auto' | 'equal' | scalar ] )

e.g.
a = np.arange(35).reshape(7, 5)
ax.imshow(a, interpolation='nearest', extent=(0.0, 1.0, 0.0, 1.0), 
aspect='auto', origin='lower')


Kind regards,
Matthias

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users