[Matplotlib-users] Fwd: making publication quality plots

2009-06-05 Thread Paul Anton Letnes
Hi Chaitanya (and everyone else),


thanks for some nice advice! The font and legend frame tips worked  
quite well.

I would appreciate it if it was possible to remove the legend frame by  
default, i.e. in the matplotlibrc file, if possible. In my opinion,  
this frame clutters the plot unnecessarily; I rarely see such frames  
in publications.


Thanks!
Paul.


Begin forwarded message:

 From: Chaitanya Krishna icym...@gmail.com
 Date: 3. juni 2009 08.26.07 GMT+02:00
 To: Paul Anton Letnes paul.anton.let...@gmail.com
 Cc: matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] making publication quality plots

 Hi Paul,

 Can you try
 font.size: 10
 legend.fontsize: small [or medium] in your rc file.

 Defining the fontsize and then defining the fontsize of the xtick
 labels, legend etc with respect to this font size seems to work better
 than defining everything by hand.

 Switching off the legend frame does seem to save some place. You can
 use pylab.legend('your legend').draw_frame(False)

 Cheers,
 Chaitanya

 On Wed, Jun 3, 2009 at 8:11 AM, Paul Anton Letnes
 paul.anton.let...@gmail.com wrote:
 On 30. mai. 2009, at 13.56, John Hunter wrote:

 On Sat, May 30, 2009 at 3:50 AM, Paul Anton Letnes
 paul.anton.let...@gmail.com wrote:
 Hello again,


 I can set the figure size and font size, that all works fine.
 However,
 the legend is prohibitively large: for a plot 3 inches wide (why
 doesn't matplotlib use centimeters or similar?), the legend takes  
 up
 about one third of the plot. This does not look too good...

 Please post a complete example.  As for inches vs cm, that is my  
 fault
 --  I can't remember if it was for matlab compatibility, or due to  
 my
 provincial ways this side of the pond.

 JDH

 Hi,

 This is my function which does the plotting. The coeffarr is a 2D
 array (function uses 7 first columns) with first column being
 frequencies, other columns being real/imag part of whatever I'm
 plotting.
 #
 import matplotlib
 matplotlib.use('ps')
 import pylab
 def plot(coeffarr):
 'Do the actual plotting.'
 nfreqs, ncoeffs = coeffarr.shape
 legends = []
 for i in range(1, 6, 2): # real part columns
 pylab.plot(coeffarr[:,0], coeffarr[:,i], RE_STYLE)
 legends.append('l = %i' % int((i + 1) / 2))
 pylab.plot(coeffarr[:,0], coeffarr[:,i+1], IM_STYLE)
 legends.append('l = %i' % int((i + 1) / 2))
 pylab.legend(legends)
 pylab.xlabel('Frequency [eV]')
 pylab.ylabel('$A_{lm}R^{-l-1}$')
 pylab.savefig(PLOTFILE)
 
 My matplotlibrc file is essentially this:
 
 backend   : MacOSX # added by paulanto on 16. feb. 08
 numerix  : numpy  # numpy, Numeric or numarray
 lines.linewidth   : 1.0 # line width in points
 font.family : serif
 font.size   : 10.0
 text.usetex : True
 axes.linewidth  : 1.0 # edge linewidth
 legend.fontsize  : 10.0
 figure.figsize   : 3.0, 2.3# figure size in inches
 

 Is this complete enough? If you do the plot, you'll see that the plot
 is about one column wide (7 cm-ish) and that the legend is relatively
 large. I made similar size plots in Gnuplot before, at font size 10,
 but the legend was somehow less dominant.

 Also, will it help getting rid of the rectangle?


 cheers,
 Paul.


 --
 OpenSolaris 2009.06 is a cutting edge operating system for  
 enterprises
 looking to deploy the next generation of Solaris that includes the  
 latest
 innovations from Sun and the OpenSource community. Download a copy  
 and
 enjoy capabilities such as Networking, Storage and Virtualization.
 Go to: http://p.sf.net/sfu/opensolaris-get
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib and qtdesigner

2009-06-05 Thread Christophe Dupre
When I started using PyQt and matplotlib, I look at these 2 examples:
http://eli.thegreenplace.net/2009/01/20/matplotlib-with-pyqt-guis/
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt4.html

Regards,

Christophe

-Original Message-
From: projetmbc [mailto:projet...@club-internet.fr] 
Sent: 04 June 2009 16:49
To: Christophe Dupre
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] matplotlib and qtdesigner 

Christophe Dupre a écrit :

 I've been developping an application using PyQT and matplotlib for a 
 while now, and instead of coding the GUI, I'd like to make use of QT 
 designer.


Hello,
I'm interested by your code or simple parts of it wich show intercation 
between PyQt and matplotilib.

Best regards.
Another Christophe.


No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.339 / Virus Database: 270.12.49/2149 - Release Date: 06/04/09 
05:53:00

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib and qtdesigner

2009-06-05 Thread Christophe Dupre
That's great, Pierre. Merci.

Christophe

-Original Message-
From: Pierre Raybaut [mailto:cont...@pythonxy.com] 
Sent: 04 June 2009 18:36
To: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] matplotlib and qtdesigner

matplotlib-users-requ...@lists.sourceforge.net a écrit :
 Message: 3
 Date: Thu, 4 Jun 2009 08:01:06 -0500
 From: Christophe Dupre christophe.du...@vhayu.com
 Subject: [Matplotlib-users] matplotlib and qtdesigner
 To: matplotlib-users@lists.sourceforge.net
 Message-ID:
   f7deb60d3092af49a15d683ce069c914028ad...@vhayu-01-ex.atlarge.net
 Content-Type: text/plain; charset=us-ascii

 Hello there,

  

 This is my first post, so first of all, thanks to the
 creators/contributors of matplotlib. It's a very nice software.

  

 I've been developping an application using PyQT and matplotlib for a
 while now, and instead of coding the GUI, I'd like to make use of QT
 designer. 

 Does anyone know how I can add a MPL FigureCanvasQTAgg to a Main Window
 form in QT designer? Any (simple) example would be great.

  

 Thanks,

  

 Christophe 
Hi,

Someone asked me the same question on Python(x,y) discussion group 
(http://pythonxy.googlegroups.com) a few days ago.

So I've included a QtDesigner plugin in Python(x,y) matplotlib package.

Here is a screenshot:
http://pythonxy.googlegroups.com/web/mplplugin.png

Here is the source code (it's quite simple actually):
http://groups.google.fr/group/pythonxy/web/QtDesigner_Plugins.zip
(simply extract this in your site-packages directory)

Cheers,
Pierre

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.339 / Virus Database: 270.12.49/2149 - Release Date: 06/04/09 
05:53:00

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] changing x axis to y and y axis to x in colorbar Object

2009-06-05 Thread Markus Feldmann
Hi All,

i try to get a colorbar to work with:
 if not hasattr(self, 'subplot3'):
 self.subplot3 = self.figure.add_subplot(111)
 self.subplot3.grid(True)
 x,y,z = self.computehistogramm(min,min+self.maxitems)
 X,Y = meshgrid(x,y)
 plot = self.subplot3.pcolor(Y,X,z)
 self.figure.colorbar(plot)

but the x and y axis are interchanged, like this:


X
|
|
|
|
|
o-Y

But i want this:
Y
|
|
|
|
|
o-X

So how can i change this ?
the x and y data also depends on Z, so when i change x--y then i have
change z too ?

Any hints for me ?

As i read in the examples and in the docu this shoul be right,
 self.subplot3.pcolor(x,y,z)

But then my x and y data are wrong assigned to z, so i wrote
 self.subplot3.pcolor(y,x,z)

How to change my code so x and y are right assigned to z and i get this:
Y
|
|
|
|
|
o-X

regards Markus


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fwd: making publication quality plots

2009-06-05 Thread John Hunter
On Fri, Jun 5, 2009 at 4:56 AM, Paul Anton
Letnespaul.anton.let...@gmail.com wrote:
 Hi Chaitanya (and everyone else),


 thanks for some nice advice! The font and legend frame tips worked
 quite well.

 I would appreciate it if it was possible to remove the legend frame by
 default, i.e. in the matplotlibrc file, if possible. In my opinion,
 this frame clutters the plot unnecessarily; I rarely see such frames
 in publications.

I frequently make the frame semi-transparent, though this won't work for EPS

  leg = ax.legend(...)
  lege.get_frame().set_alpha(0.5)

Some rc default for the legend frame (on/off, alpha) would be useful.

JDH

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] consistent colors between imshow and scatter

2009-06-05 Thread Karl Young

I have 2 float arrays of the same dimension which I use to generate a 
3rd array, again of the same dimension, containing integers from a small 
set (I obtain the 3rd array via clustering in the 2 dimensional space of 
points obtained as values from the same location in the initial 2 
arrays). I'd like to do a scatter plot using scatter, with x-axis values 
as values from the first array, y-values as values from the second array 
and color of the points corresponding to the integer in the 3rd array 
(so far so good; I can do that much). Then I'd like to plot an image 
using imshow of the 3rd array with colors corresponding to those in the 
scatter plot. I can generate the image with imshow ok but can't the 
colors to match those in the scatter plot. Here's a snippet (assume 
array1,array2, and array3 are 2D arrays):

hot()
scatter(array1.ravel(), array2.ravel(), c = 
numpy.array(array3.ravel(),float))
 imshow(array3)
show()

The main problem is that I can't figure out how to force the plot colors 
for imshow to correspond to those in scatter. Thanks for any thought or 
suggestions. Cheers,

-- KY

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Setting axis range so it is not rescaled

2009-06-05 Thread John Hunter
On Thu, Jun 4, 2009 at 5:33 PM, Sandro Tosi matrixh...@gmail.com wrote:
 Hi,

 On Thu, Jun 4, 2009 at 23:26, citronade ricit...@mac.com wrote:

 I am trying to set the x and y axis range on a log-log plot. The ranges I
 give are automatically adjusted to the nearest power of 10, but I would like
 to have the minimum and maximum axis values not be powers of 10. Is there a
 way to set the axis range so that it is not automatically rescaled?

You can turn autoscaling off entirely with

  ax.set_autoscale_on(False)

And then set the xlim/ylim as you like as Sandro suggested.

JDH

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] consistent colors between imshow and scatter

2009-06-05 Thread John Hunter
On Thu, Jun 4, 2009 at 6:38 PM, Karl Youngkarl.yo...@ucsf.edu wrote:

 I have 2 float arrays of the same dimension which I use to generate a
 3rd array, again of the same dimension, containing integers from a small
 set (I obtain the 3rd array via clustering in the 2 dimensional space of
 points obtained as values from the same location in the initial 2
 arrays). I'd like to do a scatter plot using scatter, with x-axis values
 as values from the first array, y-values as values from the second array
 and color of the points corresponding to the integer in the 3rd array
 (so far so good; I can do that much). Then I'd like to plot an image
 using imshow of the 3rd array with colors corresponding to those in the
 scatter plot. I can generate the image with imshow ok but can't the
 colors to match those in the scatter plot. Here's a snippet (assume
 array1,array2, and array3 are 2D arrays):

 hot()
 scatter(array1.ravel(), array2.ravel(), c =
 numpy.array(array3.ravel(),float))
  imshow(array3)
 show()

 The main problem is that I can't figure out how to force the plot colors
 for imshow to correspond to those in scatter. Thanks for any thought or
 suggestions. Cheers,


w/o a complete, self contained code sample that we can run and play
with on our machines, it is harder to help.  Have you tried forcing
the clim to be set to the interval you want?

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.clim

JDH

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] one data set, two y axis scales

2009-06-05 Thread John Hunter
On Thu, Jun 4, 2009 at 12:16 PM, Jae-Joon Leelee.j.j...@gmail.com wrote:
 I hope the code below gives you some idea.


 def Tc(Tf): return (5./9.)*(Tf-32)

 ax1 = subplot(111) # y-axis in F
 ax2 = twinx() # y-axis in C

 def update_ax2(ax1):
y1, y2 = ax1.get_ylim()
ax2.set_ylim(Tc(y1), Tc(y2))

 # automatically update ylim of ax2 when ylim of ax1 changes.
 ax1.callbacks.connect(ylim_changed, update_ax2)
 ax1.plot([78, 79, 79, 77])

Yes, this is a cute little example.  I was thinking along the lines
Ryan was, to just plot the same data twice with twinx, but this is
cleverer.   I added it to svn as:
examples/api/fahrenheit_celcius_scales.py

But using twinx has always been a hack.  I think what we really need
is to have each spine have it's own locator, formatter and tick
collection (eg the natural points for Celcius ticks are different from
the natural points for Fahrenheit ticks) and currently the left and
right ticks of an axis share the axis locator and formatter.
Currently the spines just draw the lines and the axes/axis handle all
the ticks and the locators.  It might be more natural to move these
into the spine itself, and support independent
ticks/locators/formatter for each spine, with the default being
shared.

Andrew, did you give this any thought in the spine implementation?  I
am pretty sure it would be hard, but maybe you have a better sense of
*how hard*.  This would be a nice enhancement.

JDH

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Newbie question

2009-06-05 Thread jorgesmbox-ml

Hi,
The matplotlib.collections.Collection documentation reads: All properties in a 
collection must be sequences or scalars; if scalars, they will be converted to 
sequences.  The property of the ith element of the collection is: prop[i % 
len(props)]. I had a look at the docstring documentation from ipython, but I 
didn't find out how the above is achieved (I am learning Python together with 
numpy, matplotlib, etc.). In my own code, how could I do something like this? 
If you point to a relevant location on the source code, that's alright. I also 
get confused sometimes because of the multiple (and sometimes interchangeable) 
ways of specifying arguments: sequences (list, tuples), numpy arrays, etc. I 
started using almost exclusively numpy arrays (probably due to my matlab 
background), but I am starting to mix a bit of everything now (depending on 
what sources of inspiration I use), so I wondered what a good guideline would 
be.

Thanks,

Jorge


  

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Open file dialog?

2009-06-05 Thread Jorge Scandaliaris
Alan G Isaac alan.is...@... writes:
snip
 That's all, as long as you don't mind destroying
 the Window manually.  (Otherwise, you need just
 a couple more lines.)
 

Thanks, I'll give this a try.


Jorge



--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] consistent colors between imshow and scatter

2009-06-05 Thread Young, Karl

Thanks for the tip and sorry I didn't include a complete code snippet; the 
current code involves images (scipy.ndimage) and clustering code and I thought 
that was a little too much too include; I'll try to extract something simpler. 
I guess the main question is how to use a set of integers to index a color 
space consistently for both scatter and imshow but I'll try to come up with a 
simple example. Thanks agan.


From: John Hunter [jdh2...@gmail.com]
Sent: Friday, June 05, 2009 5:43 AM
To: Young, Karl
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] consistent colors between imshow and scatter

On Thu, Jun 4, 2009 at 6:38 PM, Karl Youngkarl.yo...@ucsf.edu wrote:

 I have 2 float arrays of the same dimension which I use to generate a
 3rd array, again of the same dimension, containing integers from a small
 set (I obtain the 3rd array via clustering in the 2 dimensional space of
 points obtained as values from the same location in the initial 2
 arrays). I'd like to do a scatter plot using scatter, with x-axis values
 as values from the first array, y-values as values from the second array
 and color of the points corresponding to the integer in the 3rd array
 (so far so good; I can do that much). Then I'd like to plot an image
 using imshow of the 3rd array with colors corresponding to those in the
 scatter plot. I can generate the image with imshow ok but can't the
 colors to match those in the scatter plot. Here's a snippet (assume
 array1,array2, and array3 are 2D arrays):

 hot()
 scatter(array1.ravel(), array2.ravel(), c =
 numpy.array(array3.ravel(),float))
  imshow(array3)
 show()

 The main problem is that I can't figure out how to force the plot colors
 for imshow to correspond to those in scatter. Thanks for any thought or
 suggestions. Cheers,


w/o a complete, self contained code sample that we can run and play
with on our machines, it is harder to help.  Have you tried forcing
the clim to be set to the interval you want?

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.clim

JDH

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] one data set, two y axis scales

2009-06-05 Thread Andrew Straw
John Hunter wrote:
 On Thu, Jun 4, 2009 at 12:16 PM, Jae-Joon Leelee.j.j...@gmail.com wrote:
 I hope the code below gives you some idea.


 def Tc(Tf): return (5./9.)*(Tf-32)

 ax1 = subplot(111) # y-axis in F
 ax2 = twinx() # y-axis in C

 def update_ax2(ax1):
y1, y2 = ax1.get_ylim()
ax2.set_ylim(Tc(y1), Tc(y2))

 # automatically update ylim of ax2 when ylim of ax1 changes.
 ax1.callbacks.connect(ylim_changed, update_ax2)
 ax1.plot([78, 79, 79, 77])
 
 Yes, this is a cute little example.  I was thinking along the lines
 Ryan was, to just plot the same data twice with twinx, but this is
 cleverer.   I added it to svn as:
 examples/api/fahrenheit_celcius_scales.py
 
 But using twinx has always been a hack.  I think what we really need
 is to have each spine have it's own locator, formatter and tick
 collection (eg the natural points for Celcius ticks are different from
 the natural points for Fahrenheit ticks) and currently the left and
 right ticks of an axis share the axis locator and formatter.
 Currently the spines just draw the lines and the axes/axis handle all
 the ticks and the locators.  It might be more natural to move these
 into the spine itself, and support independent
 ticks/locators/formatter for each spine, with the default being
 shared.
 
 Andrew, did you give this any thought in the spine implementation?  I
 am pretty sure it would be hard, but maybe you have a better sense of
 *how hard*.  This would be a nice enhancement.

I think this would be a good direction, as well. It would also allow
disabling the tick mark labels in some axes that share the same axis --
because the ticks/labels would belong to the spine, which itself
wouldn't (necessarily) be shared.

I can't promise anything, but this may be a solution to the issues that
Jae-Joon pointed out w.r.t loglog plots in the spine implementation
(although I suspect they are more general). I'll take a look at it,
although I can't say exactly when I'll do so -- hopefully within the
coming week.

-Andrew

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] one data set, two y axis scales

2009-06-05 Thread John Hunter
On Fri, Jun 5, 2009 at 11:44 AM, Andrew Strawstraw...@astraw.com wrote:

 I think this would be a good direction, as well. It would also allow
 disabling the tick mark labels in some axes that share the same axis --
 because the ticks/labels would belong to the spine, which itself
 wouldn't (necessarily) be shared.

 I can't promise anything, but this may be a solution to the issues that
 Jae-Joon pointed out w.r.t loglog plots in the spine implementation
 (although I suspect they are more general). I'll take a look at it,
 although I can't say exactly when I'll do so -- hopefully within the
 coming week.

If you go this route, you may want to look at abolishing the Tick
class entirely -- once the ticks are associated with a spine, we will
not need the tick1line, tick2line, label1, label2 instances.  We can
draw all the ticks along a given spine with a single Line2D object
using the marker styles TICKLEFT, TICKRIGHT, TICKUP, and TICKDOWN.  We
really do not need heterogeneous properties along a given spine, so we
are paying a lot to have separate artist instances for each of these
things.  The tick labels will be a little harder since Text is so
complicated, so you might want to punt at the outset and just have the
spine hold a list of Text instances, and down the road we can think
about a more efficient text collection if necessary.

Thinking out loud  But for nonlinear coordinate systems, where
ticks may be oriented in different directions, the single Line2D idea
may not work so tread cautiously -- perhaps a line collection for the
tick lines

I am willing to have some breakage in support of this, though we can
try to make the top level axes methods accessor  (e get_xticklabels)
do the intuitive thing.

JDH

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] changing x axis to y and y axis to x in colorbar Object

2009-06-05 Thread Eric Firing
Markus Feldmann wrote:
 Hi All,
 
 i try to get a colorbar to work with:
  if not hasattr(self, 'subplot3'):
  self.subplot3 = self.figure.add_subplot(111)
  self.subplot3.grid(True)
  x,y,z = self.computehistogramm(min,min+self.maxitems)
  X,Y = meshgrid(x,y)
  plot = self.subplot3.pcolor(Y,X,z)
  self.figure.colorbar(plot)
 
 but the x and y axis are interchanged, like this:
 
 
 X
 |
 |
 |
 |
 |
 o-Y
 
 But i want this:
 Y
 |
 |
 |
 |
 |
 o-X
 
 So how can i change this ?
 the x and y data also depends on Z, so when i change x--y then i have
 change z too ?
 

I don't understand what your question has to do with the colorbar; but 
in anything like pcolor, if you swap X and Y, then at the same time you 
need to transpose Z.
http://matplotlib.sourceforge.net/api/pyplot_api.html#axes-pcolor-grid-orientation

Eric

 Any hints for me ?
 
 As i read in the examples and in the docu this shoul be right,
  self.subplot3.pcolor(x,y,z)
 
 But then my x and y data are wrong assigned to z, so i wrote
  self.subplot3.pcolor(y,x,z)
 
 How to change my code so x and y are right assigned to z and i get this:
 Y
 |
 |
 |
 |
 |
 o-X
 
 regards Markus
 
 
 --
 OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
 looking to deploy the next generation of Solaris that includes the latest 
 innovations from Sun and the OpenSource community. Download a copy and 
 enjoy capabilities such as Networking, Storage and Virtualization. 
 Go to: http://p.sf.net/sfu/opensolaris-get
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] consistent colors between imshow and scatter

2009-06-05 Thread Eric Firing
Young, Karl wrote:
 Thanks for the tip and sorry I didn't include a complete code
 snippet; the current code involves images (scipy.ndimage) and
 clustering code and I thought that was a little too much too include;
 I'll try to extract something simpler. I guess the main question is
 how to use a set of integers to index a color space consistently for
 both scatter and imshow but I'll try to come up with a simple
 example. Thanks agan.
 

Karl,

It sounds like you need to specify the norm=colors.NoNorm() argument.
http://matplotlib.sourceforge.net/api/colors_api.html?highlight=nonorm#matplotlib.colors.NoNorm
   Then if your data are integers (typed as integers, not just taking 
integer values), they will be interpreted as indices into the color 
table.  You will probably also want to generate that table yourself and 
specify it via the cmap=my_cmap kwarg.  If you have only a few values, 
then you may want to generate it as a colors.ListedColormap:
http://matplotlib.sourceforge.net/api/colors_api.html?highlight=listedcolormap#matplotlib.colors.ListedColormap
http://matplotlib.sourceforge.net/examples/api/colorbar_only.html?highlight=listedcolormap

It looks like we don't have any good examples sitting around showing the 
use of NoNorm; but try it anyway.

Eric


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] consistent colors between imshow and scatter

2009-06-05 Thread Young, Karl
Hi Eric,

Thanks much - I'll try that.


From: Eric Firing [efir...@hawaii.edu]
Sent: Friday, June 05, 2009 10:43 AM
To: Young, Karl
Cc: John Hunter; matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] consistent colors between imshow and scatter

Young, Karl wrote:
 Thanks for the tip and sorry I didn't include a complete code
 snippet; the current code involves images (scipy.ndimage) and
 clustering code and I thought that was a little too much too include;
 I'll try to extract something simpler. I guess the main question is
 how to use a set of integers to index a color space consistently for
 both scatter and imshow but I'll try to come up with a simple
 example. Thanks agan.


Karl,

It sounds like you need to specify the norm=colors.NoNorm() argument.
http://matplotlib.sourceforge.net/api/colors_api.html?highlight=nonorm#matplotlib.colors.NoNorm
   Then if your data are integers (typed as integers, not just taking
integer values), they will be interpreted as indices into the color
table.  You will probably also want to generate that table yourself and
specify it via the cmap=my_cmap kwarg.  If you have only a few values,
then you may want to generate it as a colors.ListedColormap:
http://matplotlib.sourceforge.net/api/colors_api.html?highlight=listedcolormap#matplotlib.colors.ListedColormap
http://matplotlib.sourceforge.net/examples/api/colorbar_only.html?highlight=listedcolormap

It looks like we don't have any good examples sitting around showing the
use of NoNorm; but try it anyway.

Eric


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] xlabel in two lines and centered

2009-06-05 Thread Yves-Alexandre
Hi,

A quick (probably easy) question: how do you do a label in two lines and 
with both lines centered?

xlabel('first line \n second line') don't center both :(

best,

-Yva.

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xlabel in two lines and centered

2009-06-05 Thread Ryan May
On Fri, Jun 5, 2009 at 2:32 PM, Yves-Alexandre yvesalexan...@hotmail.comwrote:

 Hi,

 A quick (probably easy) question: how do you do a label in two lines and
 with both lines centered?

 xlabel('first line \n second line') don't center both :(


Try removing the spaces, that makes it look good for me:

xlabel('first line\nsecond line')

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xlabel in two lines and centered

2009-06-05 Thread Gökhan SEVER
Hi,

I sometimes create matplotlib plots without any labels on them -figures
only. Then I add appropriate titles and/or labels using either MS Word or OO
Writer.

A few times used GIMP too to add additional texts. When I can't easily
figure out things in matplotlib this method turns out helpful to accomplish
the task.

Gökhan


On Fri, Jun 5, 2009 at 2:32 PM, Yves-Alexandre yvesalexan...@hotmail.comwrote:

 Hi,

 A quick (probably easy) question: how do you do a label in two lines and
 with both lines centered?

 xlabel('first line \n second line') don't center both :(

 best,

 -Yva.


 --
 OpenSolaris 2009.06 is a cutting edge operating system for enterprises
 looking to deploy the next generation of Solaris that includes the latest
 innovations from Sun and the OpenSource community. Download a copy and
 enjoy capabilities such as Networking, Storage and Virtualization.
 Go to: http://p.sf.net/sfu/opensolaris-get
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] consistent colors between imshow and scatter

2009-06-05 Thread Karl Young

hmmm... in response to John's earlier request I cobbled a simple example 
but that seems to work; either there's a strange error in the more 
complex version or my misunderstanding of color maps is messing with me. 
Anyway, for the record, here's an example of what I want to do (that 
actually seems to work)



#!/usr/bin/env python

# Example to try and use same color maps for scatter and imshow

import numpy as np
from pylab import *

# size of array dimensions
size = 10

# cluster centers
acenter1 = 3.0
asigma1 = 1.0
bcenter1 = 6.0
bsigma1 = 0.5

acenter2 = 8.0
asigma2 = 2.0
bcenter2 = 3.0
bsigma2 = 1.0

acenter3 = 13.0
asigma3 = 2.0
bcenter3 = 10.0
bsigma3 = 1.0

# populate arrays with random values distrubted about 2 locations
# (i.e. 2 clusters)

a = np.zeros([size,size],float)
b = np.zeros([size,size],float)
c = np.zeros([size,size],int)

# populate arrays
for i in range(size):
for j in range(size):
switcher = np.random.randint(3)
if switcher == 0: # cluster 1
a[i,j] = np.random.normal(acenter1,asigma1)
b[i,j] = np.random.normal(bcenter1,bsigma1)
c[i,j] = 0
elif switcher == 1 : # cluster 2
a[i,j] = np.random.normal(acenter2,asigma2)
b[i,j] = np.random.normal(bcenter2,bsigma2)
c[i,j] = 1
else:
   a[i,j] = np.random.normal(acenter3,asigma3)
   b[i,j] = np.random.normal(bcenter3,bsigma3)
   c[i,j] = 2

hot()
subplot(1,2,1)
scatter(np.ravel(a),np.ravel(b),c=np.ravel(c))
subplot(1,2,2)
imshow(c)

show()





 Young, Karl wrote:
   
 Thanks for the tip and sorry I didn't include a complete code
 snippet; the current code involves images (scipy.ndimage) and
 clustering code and I thought that was a little too much too include;
 I'll try to extract something simpler. I guess the main question is
 how to use a set of integers to index a color space consistently for
 both scatter and imshow but I'll try to come up with a simple
 example. Thanks agan.

 

 Karl,

 It sounds like you need to specify the norm=colors.NoNorm() argument.
 http://matplotlib.sourceforge.net/api/colors_api.html?highlight=nonorm#matplotlib.colors.NoNorm
Then if your data are integers (typed as integers, not just taking 
 integer values), they will be interpreted as indices into the color 
 table.  You will probably also want to generate that table yourself and 
 specify it via the cmap=my_cmap kwarg.  If you have only a few values, 
 then you may want to generate it as a colors.ListedColormap:
 http://matplotlib.sourceforge.net/api/colors_api.html?highlight=listedcolormap#matplotlib.colors.ListedColormap
 http://matplotlib.sourceforge.net/examples/api/colorbar_only.html?highlight=listedcolormap

 It looks like we don't have any good examples sitting around showing the 
 use of NoNorm; but try it anyway.

 Eric

 .

   


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] one data set, two y axis scales

2009-06-05 Thread Jae-Joon Lee
John,

These ideas have been part of motivation behind my axes_grid toolkit.
In the module documentation of
lib/mpl_toolkits/axes_grid/axislines.py, I tried to briefly explain
what I wanted and what I implemented, although the explanation is very
far from complete (also some examples are found in
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisline
). Note that my ultimate goal was to support the curvelinear
coordinate system, as demonstrated in my recent example
(examples/axes_grid/demo_curvelinear_grid.py).

And my hope is that, if we're going to this direction and somehow
expand the spines to support these ideas, please make it possible to
customize and expand although only the basic features are supported by
the vanilla mpl. For example, in curvelinear coordinate, ticks can
have arbitrary angles, so I hope that the tickstyles are not strictly
limited to [TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN] by design. It would
be great if there is a chance to discuss about the overall design
before implementing something in this regard.

My current implementation in axes_grid toolkit became rather
complicated, and some of them are implemented in quick and dirty ways.
However, I guess it would be helpful to go over how thing are
currently implemented in axes_grid toolkit and further discuss how
we're going to do this within the mpl. I'll try to write up short
documentation  about my design during this weekend.

Regards,

-JJ







On Fri, Jun 5, 2009 at 1:07 PM, John Hunterjdh2...@gmail.com wrote:
 On Fri, Jun 5, 2009 at 11:44 AM, Andrew Strawstraw...@astraw.com wrote:

 I think this would be a good direction, as well. It would also allow
 disabling the tick mark labels in some axes that share the same axis --
 because the ticks/labels would belong to the spine, which itself
 wouldn't (necessarily) be shared.

 I can't promise anything, but this may be a solution to the issues that
 Jae-Joon pointed out w.r.t loglog plots in the spine implementation
 (although I suspect they are more general). I'll take a look at it,
 although I can't say exactly when I'll do so -- hopefully within the
 coming week.

 If you go this route, you may want to look at abolishing the Tick
 class entirely -- once the ticks are associated with a spine, we will
 not need the tick1line, tick2line, label1, label2 instances.  We can
 draw all the ticks along a given spine with a single Line2D object
 using the marker styles TICKLEFT, TICKRIGHT, TICKUP, and TICKDOWN.  We
 really do not need heterogeneous properties along a given spine, so we
 are paying a lot to have separate artist instances for each of these
 things.  The tick labels will be a little harder since Text is so
 complicated, so you might want to punt at the outset and just have the
 spine hold a list of Text instances, and down the road we can think
 about a more efficient text collection if necessary.

 Thinking out loud  But for nonlinear coordinate systems, where
 ticks may be oriented in different directions, the single Line2D idea
 may not work so tread cautiously -- perhaps a line collection for the
 tick lines

 I am willing to have some breakage in support of this, though we can
 try to make the top level axes methods accessor  (e get_xticklabels)
 do the intuitive thing.

 JDH


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users