Re: [Matplotlib-users] boxplot bug

2010-02-23 Thread Ariel Rokem
No - not the 'widths' kwarg. I want something that *looks* like the boxplot,
but for which I will have control of setting the ranges delimited by the box
and delimited by the whiskers (in the vertical dimension, not the horizontal
dimension). I resorted to hacking something from the existing code (see
attached diff). This simply allows you to over-ride the computation of
box_y, med_y and the wisk_lo and wisk_hi, which are otherwise derived from
the data. In other words, it allows you to ignore the data :-)

Cheers - Ariel


On Tue, Feb 23, 2010 at 3:15 PM, Gökhan Sever  wrote:

>
>
> On Tue, Feb 23, 2010 at 5:04 PM, Ariel Rokem  wrote:
>
>> Hi -
>>
>> yes - but I want something that looks like the generic boxplot, but in
>> which I can control where the edges of the boxes are placed what the sizes
>> of the whiskers are. A combination of errorbar and bar, with this
>> appearance, if you will.
>>
>> Cheers - Ariel
>>
>>
>
> I guess then yours will be a non-standard box-plot because in a regular
> boxplot median is at 50th percentile, and the edges are at 25 and 75th
> respectively. There is no consensus for whiskers some uses 5 and 95 some 10
> - 90 or you could come up with your own pair. Don't get surprised if you see
> different results for different percentiles. See at
> http://old.nabble.com/incorrect-boxplot--td25440025.html
>
> Probably you don't seek something like boxplot's widths kw arg if I
> understand you right?
>
>
>
>>
>> On Tue, Feb 23, 2010 at 2:49 PM, Gökhan Sever wrote:
>>
>>>
>>>
>>> On Tue, Feb 23, 2010 at 3:02 PM, Ariel Rokem wrote:
>>>
 Hi - more generally, is there any way to control the location of the
 median line, the vertical size of the box and the vertical location of the
 whiskers?

 Thanks - Ariel


>>> Aren't those generically calculated from the data?
>>>
>>>
>>> --
>>> Gökhan
>>>
>>
>>
>>
>> --
>> Ariel Rokem
>> Helen Wills Neuroscience Institute
>> University of California, Berkeley
>> http://argentum.ucbso.berkeley.edu/ariel
>>
>
>
>
> --
> Gökhan
>



-- 
Ariel Rokem
Helen Wills Neuroscience Institute
University of California, Berkeley
http://argentum.ucbso.berkeley.edu/ariel


box_plot_diff.diff
Description: Binary data
--
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] hoe to update a plot

2010-02-23 Thread Mathew Yeates
This looks correct. I went and look at the animation examples and they do
something similar.

Thx

-- Forwarded message --
From: Stephen George 
Date: Tue, Feb 23, 2010 at 6:28 PM
Subject: Re: [Matplotlib-users] hoe to update a plot
To: Matplotlib Users 


C M wrote:
> On Tue, Feb 23, 2010 at 7:00 PM, Mathew Yeates 
wrote:
>
>> Hi
>> I am using gtk and displaying a plot in a FigureCanvas. In response to an
>> event, I want to update the plot with new data.
>>
>> e.g.
>> self.fig = Figure(figsize=(5,5), dpi=100)
>> self.ax = fig.add_subplot(111)
>> ax.plot(data[0,0:,0],
>>
>>
>>
>> canvas = FigureCanvas(fig)
>> canvas.set_size_request(500,500)
>>
>> def on_some_signal(self,widget):
>> ?
>>
>
>
I also may be wrong.

I thought ax.plot(..) would redraw everything (ticks, labels, etc)  to
do with the plot.

I've been using set_data as I thought it was meant to be quicker.
   self.cline[0].set_data(rX, myabs) # I have to make sure
I use correct line
::  ::
   self.canvas.draw()

To just change the data associated with a specific line on plot.

I stored the lines on my graph in a list called cline,  I captured the
line at time of creating of the plot
   r = self.axis.plot( rX, myabs ,self.linestyle, color='b')
   self.cline.append( r[0] )


- Steve




--
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


On Tue, Feb 23, 2010 at 6:28 PM, Stephen George
wrote:

> C M wrote:
> > On Tue, Feb 23, 2010 at 7:00 PM, Mathew Yeates 
> wrote:
> >
> >> Hi
> >> I am using gtk and displaying a plot in a FigureCanvas. In response to
> an
> >> event, I want to update the plot with new data.
> >>
> >> e.g.
> >> self.fig = Figure(figsize=(5,5), dpi=100)
> >> self.ax = fig.add_subplot(111)
> >> ax.plot(data[0,0:,0],
> >>
> >>
> >>
> >> canvas = FigureCanvas(fig)
> >> canvas.set_size_request(500,500)
> >>
> >> def on_some_signal(self,widget):
> >> ?
> >>
> >>
> I also may be wrong.
>
> I thought ax.plot(..) would redraw everything (ticks, labels, etc)  to
> do with the plot.
>
> I've been using set_data as I thought it was meant to be quicker.
>self.cline[0].set_data(rX, myabs) # I have to make sure
> I use correct line
> ::  ::
>self.canvas.draw()
>
> To just change the data associated with a specific line on plot.
>
> I stored the lines on my graph in a list called cline,  I captured the
> line at time of creating of the plot
>r = self.axis.plot( rX, myabs ,self.linestyle, color='b')
>self.cline.append( r[0] )
>
>
> - Steve
>
>
>
>
>
> --
> 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] hoe to update a plot

2010-02-23 Thread Stephen George
C M wrote:
> On Tue, Feb 23, 2010 at 7:00 PM, Mathew Yeates  wrote:
>   
>> Hi
>> I am using gtk and displaying a plot in a FigureCanvas. In response to an
>> event, I want to update the plot with new data.
>>
>> e.g.
>> self.fig = Figure(figsize=(5,5), dpi=100)
>> self.ax = fig.add_subplot(111)
>> ax.plot(data[0,0:,0],
>>
>>
>>
>> canvas = FigureCanvas(fig)
>> canvas.set_size_request(500,500)
>>
>> def on_some_signal(self,widget):
>> ?
>>
>>
>> I've tried a number of different things. How do you do this?
>> 
>
> I may be wrong here, but isn't it:
>
> def on_some_signal(self,widget):
> ax.plot(yournewdata)
> canvas.draw()
>
> Che
>
>   
I also may be wrong.

I thought ax.plot(..) would redraw everything (ticks, labels, etc)  to 
do with the plot.

I've been using set_data as I thought it was meant to be quicker.
self.cline[0].set_data(rX, myabs) # I have to make sure 
I use correct line
 ::  ::
self.canvas.draw()

To just change the data associated with a specific line on plot.

I stored the lines on my graph in a list called cline,  I captured the 
line at time of creating of the plot
r = self.axis.plot( rX, myabs ,self.linestyle, color='b')
self.cline.append( r[0] )


- Steve




--
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] hoe to update a plot

2010-02-23 Thread C M
On Tue, Feb 23, 2010 at 7:00 PM, Mathew Yeates  wrote:
> Hi
> I am using gtk and displaying a plot in a FigureCanvas. In response to an
> event, I want to update the plot with new data.
>
> e.g.
> self.fig = Figure(figsize=(5,5), dpi=100)
> self.ax = fig.add_subplot(111)
> ax.plot(data[0,0:,0],
>
>
>
> canvas = FigureCanvas(fig)
> canvas.set_size_request(500,500)
>
> def on_some_signal(self,widget):
>     ?
>
>
> I've tried a number of different things. How do you do this?

I may be wrong here, but isn't it:

def on_some_signal(self,widget):
ax.plot(yournewdata)
canvas.draw()

Che

--
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] hoe to update a plot

2010-02-23 Thread Mathew Yeates
Hi
I am using gtk and displaying a plot in a FigureCanvas. In response to an
event, I want to update the plot with new data.

e.g.
self.fig = Figure(figsize=(5,5), dpi=100)
self.ax = fig.add_subplot(111)
ax.plot(data[0,0:,0],



canvas = FigureCanvas(fig)
canvas.set_size_request(500,500)

def on_some_signal(self,widget):
?


I've tried a number of different things. How do you do this?

Mathew
--
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] Looping through all the built-in colormaps

2010-02-23 Thread David Goldsmith
Hi!  I'm trying to loop through all the built-in colormaps, applying each to an 
image before printing it to a file, then moving on to the next one.

>>> from matplotlib import cm
>>> for cmap in dir(cm): # cmap in cm doesn't work 'cause cm is a module
>>>ax.imshow(image, cmap)
>>>canvas.print_figure('image_'+cmap)

works until cmap == 'LUTSIZE', which evaluates to an integer and thus raises an 
exception.  I tried putting it in a try/except:

>>> for cmap in dir(cm):
>>>try: 
>>>ax.imshow(image, cmap)
>>>canvas.print_figure('image_'+cmap)
>>>except:
>>>pass

but despite this, after 'LUTSIZE', every cmap - even valid ones - also raises 
the exception, and thus doesn't get used.  So I tried just by-passing cmap == 
'LUTSIZE' (in the obvious way), but then encountered cmap == 'ScalarMapable', 
which resulted in the same subsequent behavior as 'LUTSIZE'.

At that point I decided I should try a "positive filter," so I figured out that 
cmaps are instances of matplotlib.colors.LinearSegmentedColormap (which I 
imported as LSC) and tried adding an "if isinstance(cmap, LSC)", but of course 
that didn't work, 'cause the elements of dir(cm) are strings, not LSC's.

At this point I've decided I've wasted too much time trying to figure this out 
on my own, so:

0) is there some "elegant" way to do what I want to do?

1) why doesn't this:

>>> for cmap in dir(cm):
>>>try: 
>>>ax.imshow(image, cmap)
>>>canvas.print_figure('image_'+cmap)
>>>except:
>>>pass

"work" (i.e., simply bypass those elements of dir(cm) which cause imshow to 
raise an exception, but then continue on as if nothing had happened)?  Is this 
a bug?

Thanks!

DG


  

--
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] boxplot bug

2010-02-23 Thread Gökhan Sever
On Tue, Feb 23, 2010 at 5:04 PM, Ariel Rokem  wrote:

> Hi -
>
> yes - but I want something that looks like the generic boxplot, but in
> which I can control where the edges of the boxes are placed what the sizes
> of the whiskers are. A combination of errorbar and bar, with this
> appearance, if you will.
>
> Cheers - Ariel
>
>

I guess then yours will be a non-standard box-plot because in a regular
boxplot median is at 50th percentile, and the edges are at 25 and 75th
respectively. There is no consensus for whiskers some uses 5 and 95 some 10
- 90 or you could come up with your own pair. Don't get surprised if you see
different results for different percentiles. See at
http://old.nabble.com/incorrect-boxplot--td25440025.html

Probably you don't seek something like boxplot's widths kw arg if I
understand you right?



>
> On Tue, Feb 23, 2010 at 2:49 PM, Gökhan Sever wrote:
>
>>
>>
>> On Tue, Feb 23, 2010 at 3:02 PM, Ariel Rokem  wrote:
>>
>>> Hi - more generally, is there any way to control the location of the
>>> median line, the vertical size of the box and the vertical location of the
>>> whiskers?
>>>
>>> Thanks - Ariel
>>>
>>>
>> Aren't those generically calculated from the data?
>>
>>
>> --
>> Gökhan
>>
>
>
>
> --
> Ariel Rokem
> Helen Wills Neuroscience Institute
> University of California, Berkeley
> http://argentum.ucbso.berkeley.edu/ariel
>



-- 
Gökhan
--
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] boxplot bug

2010-02-23 Thread Ariel Rokem
Hi -

yes - but I want something that looks like the generic boxplot, but in which
I can control where the edges of the boxes are placed what the sizes of the
whiskers are. A combination of errorbar and bar, with this appearance, if
you will.

Cheers - Ariel


On Tue, Feb 23, 2010 at 2:49 PM, Gökhan Sever  wrote:

>
>
> On Tue, Feb 23, 2010 at 3:02 PM, Ariel Rokem  wrote:
>
>> Hi - more generally, is there any way to control the location of the
>> median line, the vertical size of the box and the vertical location of the
>> whiskers?
>>
>> Thanks - Ariel
>>
>>
> Aren't those generically calculated from the data?
>
>
> --
> Gökhan
>



-- 
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] PNG images and image area

2010-02-23 Thread Jae-Joon Lee
It is best to create a figure of a right size in the first place.

If this cannot be done, try something like below.

dpi = 80
fig=figure(1, dpi=dpi)
ax = axes((0,0,1,1))
ax.set_aspect(1)

from matplotlib.transforms import TransformedBbox, Affine2D
w, h = fig.get_size_inches()
bbox = TransformedBbox(ax.bbox,
fig.transFigure.inverted()+Affine2D().scale(w, h))

savefig("a.png", bbox_inches=bbox, dpi=dpi)

Note that the size of the output will be different from the original
figure size.
Regards,

-JJ


On Tue, Feb 23, 2010 at 3:37 PM, Bruce Ford  wrote:
> I'm attempting to output an image with a predictable bounding box so
> that it can be placed into a KML document and be correctly
> georeferenced.
>
> Essentially I need a PNG that has NO labeling and the size of the
> image be exactly the size of the plot bounding box and no more, no
> less.
>
> I can get exactly what I want with the top and bottom of the image with:
>
> fig.add_axes((0,0,1,1)
>
> However, I'm still left with undesired space on the left and right.
> How can I bring the left and right edges of the bounding box to match
> the image width?
>
> Also, this might be a candidate for a handy function for
> pyplot.figure().  This could be very useful for anyone needing to make
> KML-friendly figures.
>
> Thanks for any ideas!
>
> Bruce
> ---
> Bruce W. Ford
> Clear Science, Inc.
> br...@clearscienceinc.com
> http://www.ClearScienceInc.com
> Phone/Fax: 904-379-9704
> 8241 Parkridge Circle N.
> Jacksonville, FL  32211
> Skype:  bruce.w.ford
> Google Talk: for...@gmail.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
>

--
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] boxplot bug

2010-02-23 Thread Gökhan Sever
On Tue, Feb 23, 2010 at 3:02 PM, Ariel Rokem  wrote:

> Hi - more generally, is there any way to control the location of the median
> line, the vertical size of the box and the vertical location of the
> whiskers?
>
> Thanks - Ariel
>
>
Aren't those generically calculated from the data?


-- 
Gökhan
--
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] configuring colorbar labels on a black background

2010-02-23 Thread Jae-Joon Lee
This seems to be a bug and I recommend you to file a bug.
This happens because Axis.set_ticklabels method only changes the
attributes of left (or bottom) tick labels.

Meanwhile, try

for t in colorbar.ax.get_yticklabels():
t.set_color("w")

-JJ

On Tue, Feb 23, 2010 at 11:03 AM, Jim Vickroy  wrote:
> Hello,
>
> I'm (unsuccessfully) trying to generate a figure (with a labeled colorbar)
> having a black background.
>
> Here is the code.
>
> _purpose_ = 'demonstrate capability to create PNG with black background
> including labeled color bar'
> _author_  = 'jim.vick...@noaa.gov'
>
> import numpy  # http://numpy.scipy.org/
> import matplotlib # http://matplotlib.sourceforge.net/index.html
> matplotlib.use('Agg') # http://matplotlib.sourceforge.net/backends.html --
> probably the fastest, non-GUI, rendering backend
> import matplotlib.pyplot as plot #
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot
> import matplotlib.cm # color maps
>
> import sys
> assert sys.version    == '2.6.4 (r264:75708, Oct 26 2009, 08:23:19)
> [MSC v.1500 32 bit (Intel)]', sys.version
> assert numpy.__version__  == '1.4.0',  numpy.__version__
> assert matplotlib.__version__ == '0.99.1', matplotlib.__version__
>
> data_min =   0
> data_max = 256
> data = numpy.random.randint(data_max, size=(512,512))
> rows_cnt, columns_cnt = data.shape
> shape    = rows_cnt, columns_cnt
> x    = numpy.empty(data.shape, dtype=int)
> y    = numpy.empty(data.shape, dtype=int)
> x[:] = numpy.arange(rows_cnt)
> y[:] = numpy.arange(columns_cnt)
> XI, YI   = numpy.meshgrid(x[0], y[0])
>
> title  = 'this is the figure title'
> plot.clf() # clear the figure
> plot.title(title,color='white',backgroundcolor='black')
> plot.axis('off')
> colormap = 'gist_heat'
> config   = dict(cmap=eval('matplotlib.cm.%s' % colormap), vmin=data_min,
> vmax=data_max) # vmin,vmax specify a fixed (color-map) scale
> plot.pcolormesh(XI, YI, data, **config)
> colorbar = plot.colorbar()
> ##
> # labels   = ??? list of strings labels ???
> labels = [str(i) for i in range(10)]
> colorbar.ax.set_yticklabels(labels, color='white')
> ##
> plot.imshow(data, interpolation='bilinear', cmap=config['cmap'],
> origin='upper', extent=[0,rows_cnt,0,columns_cnt])
> # plot.show() # interactive
> filename = 'trial-plot-with-labeled-colorbar.png'
> plot.savefig(filename, facecolor='black')
> plot.close()
>
> which generates a figure with a black background and invisible (black) color
> bar labels.
>
> I'm probably going about this completely wrong.
>
> Questions:
>
> How do I get white color bar labels?
> How do I access the generated sequence of string labels (for use as the
> first set_yticklabels parameter) rather than artificially defining a list of
> labels?
>
> Thanks,
> -- jv
>
> --
> 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] Display Pixel intensity

2010-02-23 Thread Jae-Joon Lee
See

http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg13203.html

http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg13204.html

-JJ


On Tue, Feb 23, 2010 at 9:22 AM, Sebastian Rhode
 wrote:
> Hi,
>
> has anyone a good idea how to interactively display the xy coordintes (as
> whole numbers) and the pixel intensity using the mouse cursor. Here is the
> code snippet:
>
> ...
> fig = plt.figure()
> ax1 = fig.add_subplot(111)
> channel_select = 1
> p = imread(filename) # normally I use TIFF file
> if (p.ndim > 2):
>     p1 = p[:,:,channel_select] # if more than 1 channel --> select
> else:
>     p1 = p
>
> ax1.imshow(p1)
> plt.show()
> ...
>
> So far only the XY coordinates are displayed, but not as whole numbers and
> even negative xy values are displayed, if the cursor is move to the corners
> (???). And of course I would like the pixel intensity to be displayed ...
>
> Thanks,
>
> Sebi
>
> --
> 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] How to create customer symbol from PNG file?

2010-02-23 Thread Jae-Joon Lee
markers are vector paths, so I don't think you can use images as markers.
But you may overlay your images using imshow.  The tricky part is to
figure out the extents of the image.

You may use OffsetImage

 
http://matplotlib.sourceforge.net/trunk-docs/examples/pylab_examples/demo_annotation_box.html

But, it is only available in the svn version of matplotlib. For
example, you may do something like below

import matplotlib.pyplot as plt
from matplotlib.offsetbox import OffsetImage, AnnotationBbox

import numpy as np

if 1:
ax = plt.subplot(111)

xx = [0.22, 0.5, 0.83]
yy = [0.5, 0.43, 0.63]

ax.plot(xx, yy, "-")

arr = np.arange(100).reshape((10,10))
im = OffsetImage(arr, zoom=2)

for x1, y1 in zip(xx, yy):
ab = AnnotationBbox(im, (x1, y1),
xycoords='data',
frameon=False)

ax.add_artist(ab)

-JJ


On Tue, Feb 23, 2010 at 9:07 AM, t putkonen  wrote:
> I would like to use custom symbols (markers) on both line charts and scatter
> charts. The symbols I would like to use are currently stored in PNG files.
> Is there a way to convert these images to markers? Symbols are pretty simple
> and contain only one colour, and the background should be transparent.
>
> --
> 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] Auto-adjusting figure height, imshow equal

2010-02-23 Thread Jae-Joon Lee
On Tue, Feb 23, 2010 at 5:43 AM, Kornél Jahn  wrote:
> Hi all!
>
> I am preparing a journal article and the figures should have a fixed width
> of 3 inches, with as thin white border around as possible. The figure does
> an imshow with equal axes:
> My problem is: I do not know in advance the height of my figure to specify
> figsize. The height should vary so that the whole figure (with ticks,
> legends and colorbanr) fits tightly into a 3 x ? inch box.
>
> I have already tried bbox_inches='tight' for savefig and looked at HowTo
> FAQ: automatically make room for tick labels for possible ideas but do no
> have a clue yet.
> Any suggestion is welcome.
>

Do you want you figure width to be exactly 3 inch? Otherwise, I wonder
why bbox_inches="tight" does not work.

My recommendation is

1) create a figure with high enough height.
2) adjust subplot parameters either manually or using the method
described in the FAQ.
3) call savefig with tight bbox option.

If you want your figure width to be exactly 3 inch, try something like below

fig = figure(1, figsize=(3,7))
ax = subplot(111)
ax.set_aspect(1)

def get_tightbbox(renderer, fig=fig):
from matplotlib.figure import Figure
from matplotlib.transforms import Bbox
bbox = Figure.get_tightbbox(fig, renderer)
w, h = fig.get_size_inches()
x1, y1, x2, y2 = bbox.extents
return Bbox.from_extents(0, y1, w, y2)

fig.get_tightbbox = get_tightbbox

savefig("a.png", bbox_inches="tight")

-JJ


> Thx very much!
>
> Kornel
>
> --
> 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] Draw only table {without XY Axis}

2010-02-23 Thread Jae-Joon Lee
Try

ax = subplot(111, frame_on=False)
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)

table(cellText=cellText, colLabels=colLabels)

-JJ


On Tue, Feb 23, 2010 at 4:06 AM, HUSSAIN BOHRA  wrote:
> Hi,
>
> Can any one tell me, How can I draw only a table in a figure (without XY
> Cordinates)
>
> Please find my code below :
>
> # do this before importing pylab or pyplot
> import matplotlib
>
> matplotlib.use('Agg')
> from matplotlib.pyplot import figure
> from matplotlib.table import table
> from pylab import *
>
> fig = figure()
>
>
> colLabels = ('Freeze', 'Wind', 'Flood', 'Quake', 'Hail')
> rowLabels = ['%d year' % x for x in (100, 50, 20, 10, 5)]
> cellText = [['66.4', '174.3', '75.1', '577.9', '32.0'], ['124.6', '555.4',
> '153.2', '677.2', '192.5'], ['213.8', '636.0', '305.7', '1175.2', '796.0'],
> ['292.2', '717.8', '456.4', '1368.5', '865.6'], ['431.5', '1049.4', '799.6',
> '2149.8', '917.9']]
> table(cellText=cellText, colLabels=colLabels)
> fig.savefig('test12.png')
>
> and also the generated png in an attachment.
>
> Can any one tell me how can i remove XY axis and have only table ?
>
> --
> Hussain Bohra
> Sr. Software Engineer
> Tavant Technologies
> Koramangala, Bangalore-95
> mailto: hussain.bo...@tavant.com
> mobile: +91 99867 95727
>
>
> --
> 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] Embedding matplotlib in Tkinter Applications

2010-02-23 Thread Alan G Isaac
On 2/23/2010 3:44 PM, Friedrich Romstedt wrote:
> http://www.friedrichromstedt.org/index.php?m=186
>

It's definitely nice to have examples around, although I won't
look at anything that's not explicitly BSD (or MIT) licensed.
Somebody on the SciPy list (I'm forgetting at the moment)
was working on a related project, so you may want to post there.

Alan Isaac

--
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] PNG images and image area

2010-02-23 Thread Friedrich Romstedt
The question has been answered I think in the thread
"Graph gains a blank space at the right hand side"
just some seconds ago.

Am I wrong?

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


Re: [Matplotlib-users] boxplot bug

2010-02-23 Thread Ariel Rokem
Hi - more generally, is there any way to control the location of the median
line, the vertical size of the box and the vertical location of the
whiskers?

Thanks - Ariel

On Tue, Feb 23, 2010 at 11:32 AM,  wrote:

>
> # ~~~
> From: Ben Axelrod [mailto:baxel...@coroware.com]
> Sent: Tuesday, February 23, 2010 9:31 AM
> To: matplotlib-users@lists.sourceforge.net
> Subject: [Matplotlib-users] boxplot bug
>
> I found an inconsistency with how boxplots are rendered between version
> 0.99.1 and the svn head.  See attached images.  I have never seen a boxplot
> cross back on itself like this before.  Is this the expected behavior?
>
> Thanks,
> -Ben
> # 
>
> Ben,
>
> Yes it is expected behavior. Confidence intervals around the median can
> easily go beyond the 1st and 3rd quartiles. If you're not comfortable with
> this, throw the data into R. I'm confident you'll get a similar result. I
> believe (not sure) that in the svn version you can specify that the CIs be
> computed from a bootstrapped median. Doing so might tighten the CIs up a
> bit.
>
> -Paul H.
>
>
> --
> 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
>



-- 
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] Graph gains a blank space at the right hand side

2010-02-23 Thread Jae-Joon Lee
On Mon, Feb 22, 2010 at 11:00 AM, Geoff Bache  wrote:
> So I guess I have two questions.
> 1) Is this a bug? It certainly feels like one...
> 2) Is there a workaround / what should I do instead?
>

Try

axessubplot2.autoscale_view(tight=True)

Otherwise, you need to manually adjust xlim and ylim.

Regards,

-JJ

--
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] Embedding matplotlib in Tkinter Applications

2010-02-23 Thread Friedrich Romstedt
I would like to know whether the following project of mine:

http://www.friedrichromstedt.org/index.php?m=186

is useful or not, because I don't know.

I made an attempt to find something like what I tried some time ago,
but I failed.

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] PNG images and image area

2010-02-23 Thread Bruce Ford
I'm attempting to output an image with a predictable bounding box so
that it can be placed into a KML document and be correctly
georeferenced.

Essentially I need a PNG that has NO labeling and the size of the
image be exactly the size of the plot bounding box and no more, no
less.

I can get exactly what I want with the top and bottom of the image with:

fig.add_axes((0,0,1,1)

However, I'm still left with undesired space on the left and right.
How can I bring the left and right edges of the bounding box to match
the image width?

Also, this might be a candidate for a handy function for
pyplot.figure().  This could be very useful for anyone needing to make
KML-friendly figures.

Thanks for any ideas!

Bruce
---
Bruce W. Ford
Clear Science, Inc.
br...@clearscienceinc.com
http://www.ClearScienceInc.com
Phone/Fax: 904-379-9704
8241 Parkridge Circle N.
Jacksonville, FL  32211
Skype:  bruce.w.ford
Google Talk: for...@gmail.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] boxplot bug

2010-02-23 Thread PHobson

# ~~~
From: Ben Axelrod [mailto:baxel...@coroware.com] 
Sent: Tuesday, February 23, 2010 9:31 AM
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] boxplot bug

I found an inconsistency with how boxplots are rendered between version 0.99.1 
and the svn head.  See attached images.  I have never seen a boxplot cross back 
on itself like this before.  Is this the expected behavior?
 
Thanks,
-Ben
# 

Ben,

Yes it is expected behavior. Confidence intervals around the median can easily 
go beyond the 1st and 3rd quartiles. If you're not comfortable with this, throw 
the data into R. I'm confident you'll get a similar result. I believe (not 
sure) that in the svn version you can specify that the CIs be computed from a 
bootstrapped median. Doing so might tighten the CIs up a bit.

-Paul H.

--
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] resolution issues

2010-02-23 Thread Eric Firing
Tornes, Ivan E wrote:
> We have a very large data set that we are trying to plot in matplotlib.  
> We found that when you have multiple data points per pixel the backend 
> does not always pick the point with the largest value to draw.  If you 
> resize the plot window it changes what is being shown on the figure.  
>  Narrow features of the curve vary in amplitude on resize of the plot 
> window.  Is there a built in solution to fix this? 
> 
>  

Yes, see 
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg15628.html

Eric


> 
> Ivan E. Tornes Ph.D.
> 
> Battelle
> 
> 505 King Avenue
> 
> Columbus, OH 43201-2693
> 
>  
> 
> Phone:614-424-5165
> 
> Fax:614-458-5165
> 
>  
> 
> 
> 
> 
> --
> 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] resolution issues

2010-02-23 Thread Tornes, Ivan E
We have a very large data set that we are trying to plot in matplotlib.  We 
found that when you have multiple data points per pixel the backend does not 
always pick the point with the largest value to draw.  If you resize the plot 
window it changes what is being shown on the figure.   Narrow features of the 
curve vary in amplitude on resize of the plot window.  Is there a built in 
solution to fix this?

Ivan E. Tornes Ph.D.
Battelle
505 King Avenue
Columbus, OH 43201-2693

Phone:614-424-5165
Fax:614-458-5165

--
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] boxplot bug

2010-02-23 Thread Ben Axelrod
I found an inconsistency with how boxplots are rendered between version 0.99.1 
and the svn head.  See attached images.  I have never seen a boxplot cross back 
on itself like this before.  Is this the expected behavior?

Thanks,
-Ben

Ben Axelrod
Robotics Engineer
(800) 641-2676 x737
[cid:031242817@23022010-0FCD]
www.coroware.com
www.corobot.net

<><><>

boxbug.py
Description: boxbug.py
--
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] A second copy of a figure

2010-02-23 Thread Jim Vickroy
Bruce Ford wrote:
> I'm needing to keep two copies of a figure, with the properties
> different on one copy.
>
> However with logic like below, both copies remain the same regardless:
>
> #I want one copy with the defaul background and one to be transparent...
>
> imgname = GenFilename(20)+".png"
> imgsrc = "../dynamic/"+imgname
> if kml == 1:
> fig1 = fig
> fig1.frameon = False
> fig1.figurePatch.set_alpha(0.0)
> imgname1 = imgname[:-4] + "-kml.png"
> imgsrc1 = "../dynamic/"+imgname1
> fig1.savefig(imgsrc1,dpi=100,transparent=True)
> fig.savefig(imgsrc,dpi=100)
>
> So, it appears that fig1=fig doesn't make a copy, but rather links
> these figures.  Is there a way to make a true separate figure that
> will allow me to alter properties in the new copy without altering the
> original.
>
> Thanks!
>
> Bruce
> ---
> Bruce W. Ford
> Clear Science, Inc.
> br...@clearscienceinc.com
> http://www.ClearScienceInc.com
> Phone/Fax: 904-379-9704
> 8241 Parkridge Circle N.
> Jacksonville, FL  32211
> Skype:  bruce.w.ford
> Google Talk: for...@gmail.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
>   

Hello Bruce,

Have you tried the standard Python copy/deepcopy function?
My matplotlib knowledge is limited so there is probably a better 
approach, but that should work.

-- jv

--
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] A second copy of a figure

2010-02-23 Thread Alan G Isaac
On 2/23/2010 12:03 PM, Bruce Ford wrote:
> Is there a way to make a true separate figure that
> will allow me to alter properties in the new copy without altering the
> original.
>

def make_my_figure():
 fig = plt.figure()
 ...
 return fig

fig1 = make_my_figure()
fig2 = make_my_figure()

Alan Isaac


--
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] Qt4Agg backend and SIGINT (ctrl+c)

2010-02-23 Thread Nicolas Bigaouette
Hi,

I cannot kill a plot by "ctrl+c" in a terminal (sending the SIGINT) when
using the Qt4Agg backend. When using GTKAgg it works fine...

What could be wrong? I need that.

Thanx!
--
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] A second copy of a figure

2010-02-23 Thread Bruce Ford
I'm needing to keep two copies of a figure, with the properties
different on one copy.

However with logic like below, both copies remain the same regardless:

#I want one copy with the defaul background and one to be transparent...

imgname = GenFilename(20)+".png"
imgsrc = "../dynamic/"+imgname
if kml == 1:
fig1 = fig
fig1.frameon = False
fig1.figurePatch.set_alpha(0.0)
imgname1 = imgname[:-4] + "-kml.png"
imgsrc1 = "../dynamic/"+imgname1
fig1.savefig(imgsrc1,dpi=100,transparent=True)
fig.savefig(imgsrc,dpi=100)

So, it appears that fig1=fig doesn't make a copy, but rather links
these figures.  Is there a way to make a true separate figure that
will allow me to alter properties in the new copy without altering the
original.

Thanks!

Bruce
---
Bruce W. Ford
Clear Science, Inc.
br...@clearscienceinc.com
http://www.ClearScienceInc.com
Phone/Fax: 904-379-9704
8241 Parkridge Circle N.
Jacksonville, FL  32211
Skype:  bruce.w.ford
Google Talk: for...@gmail.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] configuring colorbar labels on a black background

2010-02-23 Thread Jim Vickroy

Hello,

I'm (unsuccessfully) trying to generate a figure (with a labeled 
colorbar) having a black background.


Here is the code.

_purpose_ = 'demonstrate capability to create PNG with black background 
including labeled color bar'

_author_  = 'jim.vick...@noaa.gov'

import numpy  # http://numpy.scipy.org/
import matplotlib # http://matplotlib.sourceforge.net/index.html
matplotlib.use('Agg') # http://matplotlib.sourceforge.net/backends.html 
-- probably the fastest, non-GUI, rendering backend
import matplotlib.pyplot as plot # 
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot

import matplotlib.cm # color maps

import sys
assert sys.version== '2.6.4 (r264:75708, Oct 26 2009, 
08:23:19) [MSC v.1500 32 bit (Intel)]', sys.version

assert numpy.__version__  == '1.4.0',  numpy.__version__
assert matplotlib.__version__ == '0.99.1', matplotlib.__version__

data_min =   0
data_max = 256
data = numpy.random.randint(data_max, size=(512,512))
rows_cnt, columns_cnt = data.shape
shape= rows_cnt, columns_cnt
x= numpy.empty(data.shape, dtype=int)
y= numpy.empty(data.shape, dtype=int)
x[:] = numpy.arange(rows_cnt)
y[:] = numpy.arange(columns_cnt)
XI, YI   = numpy.meshgrid(x[0], y[0])

title  = 'this is the figure title'
plot.clf() # clear the figure
plot.title(title,color='white',backgroundcolor='black')
plot.axis('off')
colormap = 'gist_heat'
config   = dict(cmap=eval('matplotlib.cm.%s' % colormap), vmin=data_min, 
vmax=data_max) # vmin,vmax specify a fixed (color-map) scale

plot.pcolormesh(XI, YI, data, **config)
colorbar = plot.colorbar()
##
# labels   = ??? list of strings labels ???
labels = [str(i) for i in range(10)]
colorbar.ax.set_yticklabels(labels, color='white')
##
plot.imshow(data, interpolation='bilinear', cmap=config['cmap'], 
origin='upper', extent=[0,rows_cnt,0,columns_cnt])

# plot.show() # interactive
filename = 'trial-plot-with-labeled-colorbar.png'
plot.savefig(filename, facecolor='black')
plot.close()

which generates a figure with a black background and invisible (black) 
color bar labels.


I'm probably going about this completely wrong.

Questions:

  1. How do I get white color bar labels?
  2. How do I access the generated sequence of string labels (for use
 as the first set_yticklabels parameter) rather than artificially
 defining a list of labels?


Thanks,
-- jv
--
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] hexbin log bins and colorbar

2010-02-23 Thread Jan Strube
Gentlemen!

Thanks a lot for your help.
This works now for me (with and without the norm in the colorbar() call)

Best,
Jan


On Tue, Feb 23, 2010 at 3:47 PM, John Hunter  wrote:

> On Mon, Feb 22, 2010 at 6:28 PM, Eric Firing  wrote:
> > Yes.  You are looking at ColorbarBase, which does not have an associated
> > mappable.  The derived Colorbar class does grab the cmap and norm from
> the
> > mappable used in the initialization.  Is this somehow not working? Did
> you
> > really need to specify the norm explicitly?
>
> No, I didn't test this, I just read the code (apparently the wrong
> code) and concluded I needed it.  I did just test w/o it and all is
> well.  Sorry for the noise.
>
> JDH
>
--
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] hist(x,bins) is not properly autoscaled in y

2010-02-23 Thread Yannick Copin
Hi,

I think there's an issue of axes autoscaling in y when plotting histograms 
with specified bins, eg.


from pylab import *

bins = linspace(-5,5,100)

hist(randn(1000), bins=bins,
  histtype='step', ec='r')
hist(randn(1), bins=bins,
  histtype='step', ec='g')

show()


Note that the y-axis is not properly autoscaled to handle the 2nd histogram. 
Could this be a regression after correction of Debian Bug #503148 ? (see 
http://www.mail-archive.com/matplotlib-de...@lists.sourceforge.net/msg04020.html)

Cheers,
-- 
.~.   Yannick COPIN  (o:>*  Doctus cum libro
/V\   Institut de physique nucleaire de Lyon (IN2P3 - France)
   // \\  Tel: (33/0) 472 431 968 AIM: YnCopin ICQ: 236931013
  /(   )\ http://snovae.in2p3.fr/ycopin/
   ^`~'^

--
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] hexbin log bins and colorbar

2010-02-23 Thread John Hunter
On Mon, Feb 22, 2010 at 6:28 PM, Eric Firing  wrote:
> Yes.  You are looking at ColorbarBase, which does not have an associated
> mappable.  The derived Colorbar class does grab the cmap and norm from the
> mappable used in the initialization.  Is this somehow not working? Did you
> really need to specify the norm explicitly?

No, I didn't test this, I just read the code (apparently the wrong
code) and concluded I needed it.  I did just test w/o it and all is
well.  Sorry for the noise.

JDH

--
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] hexbin log bins and colorbar

2010-02-23 Thread John Hunter
On Tue, Feb 23, 2010 at 4:12 AM, Jan Strube  wrote:
> Hi John,
> thanks for keeping at it. I have updated from svn
> But this script
>   File
> "/Users/Jan/PYTHON/lib/python2.6/site-packages/matplotlib-1.0.svn_r8037-py2.6-macosx-10.6-universal.egg/matplotlib/colorbar.py",
> line 278, in _config_axes
>     ticks, ticklabels, offset_string = self._ticker()
>   File
> "/Users/Jan/PYTHON/lib/python2.6/site-packages/matplotlib-1.0.svn_r8037-py2.6-macosx-10.6-universal.egg/matplotlib/colorbar.py",
> line 417, in _ticker
>     b = np.array(locator())
>   File
> "/Users/Jan/PYTHON/lib/python2.6/site-packages/matplotlib-1.0.svn_r8037-py2.6-macosx-10.6-universal.egg/matplotlib/ticker.py",
> line 1085, in __call__
>     vmin = self.axis.get_minpos()
> AttributeError: DummyAxis instance has no attribute 'get_minpos'

Take a look at the file name in the traceback: matplotlib-1.0.svn_r8037

The r8037 is the svn revision number.  According the svn log, I made
my commit on r8149, so you are not running HEAD.  You may have
multiple matplotlib's installed and are not picking up the right egg.
I recommend

  > rm -rf /Users/Jan/PYTHON/lib/python2.6/site-packages/matplotlib*

and then doing a clean install from mpl svn r8149 or later.

JDH

--
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] Display Pixel intensity

2010-02-23 Thread Sebastian Rhode
Hi,

has anyone a good idea how to interactively display the xy coordintes (as
whole numbers) and the pixel intensity using the mouse cursor. Here is the
code snippet:

...
fig = plt.figure()
ax1 = fig.add_subplot(111)
channel_select = 1
p = imread(filename) # normally I use TIFF file
if (p.ndim > 2):
p1 = p[:,:,channel_select] # if more than 1 channel --> select
else:
p1 = p

ax1.imshow(p1)
plt.show()
...

So far only the XY coordinates are displayed, but not as whole numbers and
even negative xy values are displayed, if the cursor is move to the corners
(???). And of course I would like the pixel intensity to be displayed ...

Thanks,

Sebi
--
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] How to create customer symbol from PNG file?

2010-02-23 Thread t putkonen
I would like to use custom symbols (markers) on both line charts and scatter
charts. The symbols I would like to use are currently stored in PNG files.
Is there a way to convert these images to markers? Symbols are pretty simple
and contain only one colour, and the background should be transparent.
--
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] Auto-adjusting figure height, imshow equal

2010-02-23 Thread Kornél Jahn
Hi all!

I am preparing a journal article and the figures should have a fixed width
of 3 inches, with as thin white border around as possible. The figure does
an imshow with *equal* axes:
My problem is: I do not know in advance the height of my figure to specify
figsize. The height should vary so that the whole figure (with ticks,
legends and colorbanr) fits tightly into a 3 x ? inch box.

I have already tried bbox_inches='tight' for savefig and looked at HowTo
FAQ: automatically make room for tick
labelsfor
possible ideas but do no have a clue yet.
Any suggestion is welcome.

Thx very much!

Kornel
--
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] Importing pylab causes exception

2010-02-23 Thread Jon Moore
Hi,

I'm using the Python(x,y) distribution which comes with matplotlib for
Windows. My OS is Windows XP with all updates and service packs on an
AMD Athlon 2600+ PC with ATI Radeon 9600 graiphics card.

Python will work fine for anything that doesn't import the pylab
component (I can import matplotlib itself no problem as well as numpy
etc) but if I try to import pylab I get:-

"An unhandled exception occured in pythonw.exe [3976]"

I've tied reinstalling Python(x,y) and even reinstalling windows then
Python(x,y) but to no avail. This seems odd to me as 2 other PCs at work
install Python(x,y) and run Pylab fine.

Any suggestions as to what I should check to track down this error?

Thanks

Jon



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4888 (20100222) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.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] Pydot graphs in matplotlib?

2010-02-23 Thread Kjell Magne Fauske


Erik Tollerud-2 wrote:
> 
> I'm curious if anyone knows a good way to embed pydot
> (http://code.google.com/p/pydot/) graphs (or really, any
> graphviz-style graphs) inside matplotlib somehow. 
> 

The closest thing is probably NetworkX (http://networkx.lanl.gov/index.html)
and PyGraphviz (http://networkx.lanl.gov/pygraphviz/)

The above tools can at least provide the position of the nodes, but I don't
think they use the drawing information provided by Graphviz.

As mentioned in another post, it is not that hard to write a Graphviz to
Matplotlib converter. Graphviz can output very detailed rendering
information when using the xdot output format
(http://www.graphviz.org/doc/info/output.html#d:xdot) Sounds like a fun
weekend project :)

- Kjell Magne Fauske

-- 
View this message in context: 
http://old.nabble.com/Pydot-graphs-in-matplotlib--tp27602474p27701290.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] hexbin log bins and colorbar

2010-02-23 Thread Jan Strube
Hi John,

thanks for keeping at it. I have updated from svn

But this script
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import LogFormatter
from matplotlib import colors

class LogFormatterHB(LogFormatter):
   def __call__(self, v, pos=None):
   vv = self._base ** v
   print vv
   return LogFormatter.__call__(self, vv, pos)

data = np.load('deltaR_parton_jet_109370.npz')
ptcut = np.logical_and(data['jetMomentum'] < 30, data['jetMomentum']>0)
deltaRCut = data['deltaR']>0
cut = np.logical_and(ptcut, deltaRCut)
fig = plt.figure()
polycol = plt.hexbin(data['jetMomentum'][cut] / 1000, data['deltaR'][cut],
gridsize=50, norm=colors.LogNorm())
plt.title('deltaR between parton(eta<2.5) and jet(eta<2.5)')
plt.xlabel('jet pt (GeV)')
plt.ylabel('deltaR')
cb = plt.colorbar(norm=polycol.norm)
cb.set_label('# entries')
fig.savefig('hexbin_demo.png', dpi=100)
#plt.show()

gives me an error:

> python test.py
Traceback (most recent call last):
  File "test.py", line 24, in 
cb = plt.colorbar(norm=polycol.norm)
  File
"/Users/Jan/PYTHON/lib/python2.6/site-packages/matplotlib-1.0.svn_r8037-py2.6-macosx-10.6-universal.egg/matplotlib/pyplot.py",
line 1356, in colorbar
ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw)
  File
"/Users/Jan/PYTHON/lib/python2.6/site-packages/matplotlib-1.0.svn_r8037-py2.6-macosx-10.6-universal.egg/matplotlib/figure.py",
line 1104, in colorbar
cb = cbar.Colorbar(cax, mappable, **kw)
  File
"/Users/Jan/PYTHON/lib/python2.6/site-packages/matplotlib-1.0.svn_r8037-py2.6-macosx-10.6-universal.egg/matplotlib/colorbar.py",
line 649, in __init__
ColorbarBase.__init__(self, ax, **kw)
  File
"/Users/Jan/PYTHON/lib/python2.6/site-packages/matplotlib-1.0.svn_r8037-py2.6-macosx-10.6-universal.egg/matplotlib/colorbar.py",
line 240, in __init__
self.draw_all()
  File
"/Users/Jan/PYTHON/lib/python2.6/site-packages/matplotlib-1.0.svn_r8037-py2.6-macosx-10.6-universal.egg/matplotlib/colorbar.py",
line 251, in draw_all
self._config_axes(X, Y)
  File
"/Users/Jan/PYTHON/lib/python2.6/site-packages/matplotlib-1.0.svn_r8037-py2.6-macosx-10.6-universal.egg/matplotlib/colorbar.py",
line 278, in _config_axes
ticks, ticklabels, offset_string = self._ticker()
  File
"/Users/Jan/PYTHON/lib/python2.6/site-packages/matplotlib-1.0.svn_r8037-py2.6-macosx-10.6-universal.egg/matplotlib/colorbar.py",
line 417, in _ticker
b = np.array(locator())
  File
"/Users/Jan/PYTHON/lib/python2.6/site-packages/matplotlib-1.0.svn_r8037-py2.6-macosx-10.6-universal.egg/matplotlib/ticker.py",
line 1085, in __call__
vmin = self.axis.get_minpos()
AttributeError: DummyAxis instance has no attribute 'get_minpos'

Cheers,
Jan



On Tue, Feb 23, 2010 at 12:26 AM, John Hunter  wrote:

> On Mon, Feb 22, 2010 at 4:33 PM, John Hunter  wrote:
> >  polycol = plt.hexbin(data['jetMomentum'][cut] / 1000,
> > data['deltaR'][cut],gridsize=50, norm=colors.LogNorm())
> >  cb = plt.colorbar(norm=colors.LogNorm())
> >
> > but this appears to be broken:
>
> I committed some changes to support this -- the following now works:
>
>  polycol = plt.hexbin(data['jetMomentum'][cut] / 1000,
> data['deltaR'][cut],gridsize=50, norm=colors.LogNorm())
>
>   cb = plt.colorbar(norm=polycol.norm)
>
> Eric - I was surprised the colorbar does not use the mappable norm by
> default (if passed norm=None).  Instead it uses ::
>
>  norm = colors.Normalize()
>
> is this a feature?
>
> JDH
>
--
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] Draw only table {without XY Axis}

2010-02-23 Thread HUSSAIN BOHRA
Hi,

Can any one tell me, How can I draw only a table in a figure (without XY
Cordinates)

Please find my code below :

*# do this before importing pylab or pyplot
import matplotlib

matplotlib.use('Agg')
from matplotlib.pyplot import figure
from matplotlib.table import table
from pylab import *

fig = figure()


colLabels = ('Freeze', 'Wind', 'Flood', 'Quake', 'Hail')
rowLabels = ['%d year' % x for x in (100, 50, 20, 10, 5)]
cellText = [['66.4', '174.3', '75.1', '577.9', '32.0'], ['124.6', '555.4',
'153.2', '677.2', '192.5'], ['213.8', '636.0', '305.7', '1175.2', '796.0'],
['292.2', '717.8', '456.4', '1368.5', '865.6'], ['431.5', '1049.4', '799.6',
'2149.8', '917.9']]
table(cellText=cellText, colLabels=colLabels)
fig.savefig('test12.png')*

and also the generated png in an attachment.

Can any one tell me how can i remove XY axis and have only table ?

-- 
Hussain Bohra
Sr. Software Engineer
Tavant Technologies
Koramangala, Bangalore-95
mailto: hussain.bo...@tavant.com
mobile: +91 99867 95727
<>--
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] How to control display precision and style (e.g., %f or %e) of axis tick labels?

2010-02-23 Thread Stephen George
David Goldsmith wrote:
> I've searched and searched the online docs...please help.
>
> DG
>   
If I understand your question correctly you probably need to look at
http://matplotlib.sourceforge.net/api/ticker_api.html#tick-formatting

ax.xaxis.set_major_formatter( xmajorFormatter )
ax.xaxis.set_minor_formatter( xminorFormatter )
 


- Steve

--
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