Re: [Matplotlib-users] Computing Simple Statistics from a Histogram

2009-12-04 Thread Wayne Watson
Hi, actually, more question was more informational than how to do it. I
wrote a function to do it, but wondered why such a function didn't seem
to exist. In my case, the histogram is from a small processor that
produces  frequency data from 307K points. Unraveling the frequency data
and returning it to original set of points seems counterproductive. The
data is produced from the pixel values in a 640x480 image.

Matthias Michler wrote:
 Hi Wayne,

 you are right all these function use the sample-data and not the pdf / 
 frequency of occurence-histogram, because typically the data is available and 
 not the pdf. Maybe the scipy mailing list could give you a solution to your 
 problem.

 In case that your freqency of occurence are integers you could do something 
 like the following to generate the sample-data and than you the previous 
 mentioned functions:
 bin_centers = np.array([ 1.,  2.,  3.,  4.,  5.])
 n_vals = np.array([1, 3, 0, 2, 1])
 sample_new = np.array([])
 for bin_center, n in zip(bin_centers, n_vals): 
 # append new value 'n' times: 
 sample_new = np.concatenate((sample_new, [bin_center]*n))

 Kind regards,
 Matthias

 On Tuesday 01 December 2009 17:51:31 Wayne Watson wrote:
   
 I do not believe that any of those calculations are based on the pdf,
 frequency of occurrence-histogram. This, (1, 2,2, 4, 2,5,4) and not this
 (1,3, 0,2,1). The latter are the frequencies of occurrence for 1,2,3,4,5.

 John Hunter wrote:
 
 On Tue, Dec 1, 2009 at 6:32 AM, Wayne Watson

 sierra_mtnv...@sbcglobal.net wrote:
   
 Is there some statistics function that computes the mean, std. dev.,
 min/max, etc. from a frequency distribution?
 
 numpy has many functions for basic descriptive statistics.  If data
 is an array of your data, you can do (import numpy as np)

 mean: np.mean(data)
 median: np.median(data)
 standard deviation: np.std(data)
 min: np.min(data)
 max: np.max(data)

 In scipy.stats, there are many more (skew, kurtosis, etc...)  See
 also, this example:


 http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/py4science/
 examples/stats_descriptives.py?view=markuppathrev=4027

 JDH
   



 --
 Join us December 9, 2009 for the Red Hat Virtual Experience,
 a free event focused on virtualization and cloud computing. 
 Attend in-depth sessions from your desk. Your couch. Anywhere.
 http://p.sf.net/sfu/redhat-sfdev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

   

-- 
   Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

  The popular press and many authorities believe the number
  of pedofiles that prowl the web is 50,00. There are no
  figures that support this. The number of children below
  18 years of age kidnapped by strangers is 1 in 600,000,
  or 115 per year. -- The Science of Fear by D. Gardner

Web Page: www.speckledwithstars.net/



--
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Publish to HTML

2009-12-04 Thread Alan G Isaac
On 12/4/2009 2:17 AM, David Arnold wrote:
 I am wondering if Sampledoc type files can be used for this same
 purpose. Is there a way you can gather the output html and upload them
 to our Sakai drop boxes?


Is the following at all related to what you want to do?
Using reStructuredText, you can use the `include` directive
to include code files, and the `figure` directive to include
figures.  The code is actually in the file produced with the
rst2html script; the figures remain in separate files.

Alan Isaac


--
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Publish to HTML

2009-12-04 Thread John Hunter
On Fri, Dec 4, 2009 at 1:17 AM, David Arnold dwarnol...@suddenlink.net wrote:
 All.

 I see the Sphinx tutorial Sampledoc on the Matplotlib site and am
 working through the tutorial. This semester, my students have really
 enjoyed using Matlab's publish to HTML tool, then they upload the
 resulting files to their Drop Box on our Sakai course management system.

 I am wondering if Sampledoc type files can be used for this same
 purpose. Is there a way you can gather the output html and upload them
 to our Sakai drop boxes?

I'm not familiar with the Sakai drop interface, but you can certainly
upload the files generated by Sphinx in _build/html to a web site.
There are normally a bunch of files that need to be uploaded, so it
would help if Sakai supports some kind of directory or zipfile upload.

JDH

--
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Beginner Problem with drawing

2009-12-04 Thread Sebastian Rhode
Hi guys,

i wrote a little program to display filter sets used for microscopy. The
spectra data are shown using matplotlib and wxmpl. The GUI hat a menu item
Set Lines -- an extra Frame with checkboxes will open up.
Upon checking or unchecking, the laser lines should be displayed or deleted
inside the main panel as vertical lines, but I juts can not figure out, how
to acess the meain panel when checking.

The problem is located in line 58, 63 and 68

Here is the code:

#!/usr/bin/env python

import numpy
from pylab import *
import scipy
import scipy.linalg
import wx
import wxmpl
import os, sys


xmin = 350
xmax = 700
ymin = 0
ymax = 1.05


# normalizes dye spectra to 1
def normspec(datain):
out = datain
out[:,1] = datain[:,1]/datain[:,1].max(0)
return out

# converts filters spectra to 0-1 range
def normspec_filter(datain):
out = datain
if datain[:,1].max(0)10:
out[:,1] = datain[:,1]/100
return out

class MyApp(wx.App):
def OnInit(self):
self.frame = MyFrame(None, -1, 'FilterSpectra')
self.frame.Show(True)
return True

class SetLaser(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(220, 130))

wl = array([405, 445, 473])
panel = wx.Panel(self, -1)

self.cb0 = wx.CheckBox(panel, 10, str(wl[0])+'nm', (10,  10))
self.cb1 = wx.CheckBox(panel, 11, str(wl[1])+'nm', (80,  10))
self.cb2 = wx.CheckBox(panel, 12, str(wl[2])+'nm', (150, 10))

self.Bind(wx.EVT_CHECKBOX, self.on_checkbox0, id=10)
self.Bind(wx.EVT_CHECKBOX, self.on_checkbox1, id=11)
self.Bind(wx.EVT_CHECKBOX, self.on_checkbox2, id=12)

self.CenterOnParent()
self.Show()

def on_checkbox0(self, event):
self.cb0value = event.IsChecked()
print self.cb0value
self.glaser0, = self.axes.plot([wl[i],wl[i]],[0,1],'b', lw=2)

def on_checkbox1(self, event):
self.cb1value = event.IsChecked()
print self.cb1value
self.glaser1, = self.axes.plot([wl[i],wl[i]],[0,1],'b', lw=2)

def on_checkbox2(self, event):
self.cb2value = event.IsChecked()
print self.cb2value
self.glaser2, = self.axes.plot([wl[i],wl[i]],[0,1],'b', lw=2)

class MyFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(1000, 800))

menuBar = wx.MenuBar()
self.CreateStatusBar()
#--
file = wx.Menu()
file.Append(100, 'Save As ...', 'Saves Figure as ...')
file.AppendSeparator()
file.Append(113, 'Quit\tCtrl+W')
#--
dyes = wx.Menu()
dyes.Append(101, 'Load Dye Absorption', 'Loads Absorption Spectra
(*.abs)')
dyes.Append(102, 'Load Dye Fluorescence', 'Loads Fluorescence
Emission Spectra (*.flu)')
dyes.AppendSeparator()
dyes.Append(111, 'Delete last Absorption', 'Deletes last Absorption
Spectra')
dyes.Append(112, 'Delete last Fluorescence', 'Deletes last
Fluorescence Emission')
#--

filter = wx.Menu()
filter.Append(103, 'Load Excitation Filter', 'Loads Excitation
Filter (*.ex)')
filter.Append(104, 'Load Dichroic Mirror', 'Loads Dichroic Mirror
(*.di)')
filter.Append(105, 'Load Emission Filter', 'Loads Emission Filter
(*.em)')
filter.AppendSeparator()
filter.Append(107, 'Delete last EX filter', 'Deletes the last EX
filter')
filter.Append(108, 'Delete last DI mirror', 'Deletes the last DI
mirror')
filter.Append(109, 'Delete last EM filter', 'Deletes the last EM
filter')
#--
lightsource = wx.Menu()
lightsource.Append(106, 'Load Light Source', 'Loads Spectral Data
of Light Source (*.txt)')
lightsource.AppendSeparator()
lightsource.Append(110, 'Delete last Light Source', 'Deletes the
last Light Source')
#--
laserline = wx.Menu()
laserline.Append(114, 'Set Laser Lines',' Displays the selected
laser lines')
#--
menuBar.Append(file, 'File')
menuBar.Append(dyes, 'Dyes')
menuBar.Append(filter, 'Filter')
menuBar.Append(lightsource, 'Light Source')
menuBar.Append(laserline, 'Laser Lines')
#--
self.SetMenuBar(menuBar)
#--
self.Bind(wx.EVT_MENU, self.saveas,id = 100)
self.Bind(wx.EVT_MENU, self.openabs,id = 

Re: [Matplotlib-users] Publish to HTML

2009-12-04 Thread Alan G Isaac
Another possibility is pyReport:
http://gael-varoquaux.info/computers/pyreport/

Alan Isaac


--
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Unable to plot simple matplotlib figures

2009-12-04 Thread Lisa M Winter
Hello.

I installed matplotlib from source in Mac OS 10.6.  However, I am  
unable to print this simple example plot:
from pylab import *
plot([1,2,3])
show()

Here is what I get when I try using TkAgg as the backend:

casa98-125-dhcp:.matplotlib lisa$ python simple_plot.py --verbose- 
helpful
$HOME=/Users/lisa
matplotlib data path /Users/lisa/.local/lib/python2.6/site-packages/ 
matplotlib/mpl-data
loaded rc file /Users/lisa/.matplotlib/matplotlibrc
matplotlib version 0.99.1.1
verbose.level helpful
interactive is True
units is False
platform is darwin
CONFIGDIR=/Users/lisa/.matplotlib
Using fontManager instance from /Users/lisa/.matplotlib/fontList.cache
backend TkAgg version 8.5
Traceback (most recent call last):
  File simple_plot.py, line 2, in module
plot([1,2,3])
  File /Users/lisa/.local/lib/python2.6/site-packages/matplotlib/ 
pyplot.py, line 2134, in plot
ax = gca()
  File /Users/lisa/.local/lib/python2.6/site-packages/matplotlib/ 
pyplot.py, line 582, in gca
ax =  gcf().gca(**kwargs)
  File /Users/lisa/.local/lib/python2.6/site-packages/matplotlib/ 
pyplot.py, line 276, in gcf
return figure()
  File /Users/lisa/.local/lib/python2.6/site-packages/matplotlib/ 
pyplot.py, line 254, in figure
**kwargs)
  File /Users/lisa/.local/lib/python2.6/site-packages/matplotlib/ 
backends/backend_tkagg.py, line 91, in new_figure_manager
canvas = FigureCanvasTkAgg(figure, master=window)
  File /Users/lisa/.local/lib/python2.6/site-packages/matplotlib/ 
backends/backend_tkagg.py, line 158, in __init__
master=self._tkcanvas, width=w, height=h)
  File /System/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/lib-tk/Tkinter.py, line 3284, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
  File /System/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/lib-tk/Tkinter.py, line 3240, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: integer value too large to represent


I've tried the MacOSX backend and that opens a GUI that has the label  
Figure 1 but no plot.  Saving to a post script file does not work  
either.  Does anyone know what the problem is?

Lisa

--
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Rotating X-Labels on AxesGrid?

2009-12-04 Thread PHobson
Hey folks,

I'm trying to make some bar plots using AxesGrid and the set_xlabels method 
doesn't seem to notice that I'm passing a 'rotation' kwarg.

Here's a small script that showing that this doesn't work:
# --
import matplotlib.pyplot as pl
from mpl_toolkits.axes_grid import AxesGrid

fig = pl.figure()
grid = AxesGrid(fig, 111, nrows_ncols=(1,1), axes_pad=0.12)
xlabs = ['paul', 'chris', 'patti']

for ax in grid:
ax.plot([1,2,3], [2,2.5,3], 'bo')
ax.set_ylim([0,5])
ax.set_xlim([0,4])
ax.set_xticks([1,2,3])
ax.set_xticklabels(xlabs, rotation=90)
# -

As you can see from the attached image, my labels aren't rotating. This is 
obviously a trivial example, but I'm trying to plot some chemical 
concentrations and the names are quite long.

Any tips? Should I just be using subpolot instead?

Python 2.6.2 and:
In [25]: import matplotlib as mpl
In [26]: mpl.__version__
Out[26]: '0.99.1'
In [27]: import numpy as np
In [28]: np.__version__
Out[28]: '1.3.0'

Thanks!

Paul M. Hobson  
Senior Staff Engineer
-- 
Geosyntec Consultants 
55 SW Yamhill St, Ste 200
Portland, OR 97204
Phone: (503) 222-9518
www.geosyntec.com


attachment: rotate_test.png--
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Matplotlib - navigation toolbar - delete x and y labelling

2009-12-04 Thread redrum

Hi all,

I'd like to delete x and y labelling in the navigation toolbar.

See picture: http://img256.imageshack.us/img256/1608/capturepc.th.png

http://old.nabble.com/file/p26636375/Capture.png 

How can I do this ?

Thanks for your answer
-- 
View this message in context: 
http://old.nabble.com/Matplotlib---navigation-toolbar---delete-x-and-y-labelling-tp26636375p26636375.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] AxesGrid problem.

2009-12-04 Thread Ryan Neve
Than you for your assistance with AxesGrid.

Concerning the documentation, on this page:
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.htmit
says:
   Name Default Description  aspect True aspect of axes
then a few lines below:
*aspect*By default (False), widths and heigths of axes in the grid are
scaled independently. If True, they are scaled according to their data
limits (similar to aspect parameter in mpl).

*Here is a more complete example of my code:
*In the following code, x_grid and y_grid are are arrays created by meshgrid
and represent time and water depth respectively.
z_dim is a dictionary of one or more arrays of sensor readings corresponding
to the depths and times in x_grid and y_grid.


from matplotlib import pyplot
from mpl_toolkits.axes_grid import AxesGrid
nrows = len(z_dim) # Number of rows
DAP_figure = pyplot.figure(1,(20,8))
pyplot.figtext(0.05,.5,Depth
(m),rotation='vertical',verticalalignment='center')
# Create a grid of axes with the AxesGrid helper class
my_grid = AxesGrid(DAP_figure, 111, # Only one grid in this figure
nrows_ncols = (nrows,1), # one or more rows, but only one
column
axes_pad = 0.0, #pad between axes in inches
aspect=False, # If True, all plots are superimposed upon one
another.
add_all=True, # not sure why this would ever be False
share_all=True, # I think this means that all axes have the
same x  y scales
label_mode = L, # labels for depth on left and time on
bottom
cbar_location=right,
cbar_mode=each, # each axes has a different scale
cbar_size=2%,
cbar_pad=1%,
)

for i,parameter in enumerate(z_dim):
z_dim[parameter] = maskDAP(z_dim[parameter],parameter,dev_mult) #Need to
mask NaNs and outliers for each grid
ax = my_grid[i].pcolor(x_grid,y_grid,z_dim[parameter])
my_grid[i].set_ylabel(long_name[parameter]) # Puts a y label on every
graph.
my_grid.cbar_axes[i].colorbar(ax)
my_grid.cbar_axes[i].axis[right].toggle(ticklabels=True,label=True)
my_grid.cbar_axes[i].set_ylabel(units[parameter]) #Puts the units on the
right side of the colorbar
pyplot.draw()
pyplot.show()

I do need a separate colorbar for each plot as they are results of different
sensors all taken at the same time and depth scales.
Here is what I have now:
[image: wutSM.png]
Which, aside from the extra scale labels on the x and y axis is getting
close.

Thank You for your help,

-Ryan


*matplotlib version:*

On Thu, Dec 3, 2009 at 4:36 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote:



 On Thu, Dec 3, 2009 at 3:40 PM, Ryan Neve ryan.n...@gmail.com wrote:


 I tried all sorts of things, but finally, by setting aspect=False I got
 it to work. In the documentation, the table says this defaults to True and
 the explanation of aspect below says it defaults to False. Although I don't
 entirely understand what is going on, I think this threw me off.
 So then I had this:


 Can you be more specific about which documentation says the default aspect
 is False? This may need to be fixed. Note that AxesGrid is designed
 for displaying images with aspect=True. Otherwise, you may better stick to
 the subplot..




 [image: 84Kna.png]
 ... which looks much better, except that there are two sets of x and y
 axis labels? This seems to have something to do with the colorbar. I've got:


 To me, there is another axes underneath the AxesGrid. It is hard to tell
 without a complete code.



 label_mode = L,
 cbar_location=right,
 cbar_mode=each,
 cbar_size=2%,
 cbar_pad=0.5%

 Now I'm trying to get scales and labels on my colorbars.
 I tried:
 for i,parameter in enumerate(z_dim):
 ax = my_grid[i].pcolor(x_grid,y_grid,z_dim[parameter]) # This is the
 pcolor plot
 my_grid[i].set_ylabel('Depth') # Correctly puts a y label on every
 plot.
 cb = my_grid.cbar_axes[i].colorbar(ax) # Puts in a colorbar for this
 axes?s
 cb.set_ylabel(parameter) #It would be nice if this was on the far
 right next to the colorbar. I don't see it anywhere. Perhaps underneath
 something?


 The label of the colorbar is set to invisible by default (this is a bug).
 So, try something like

 my_grid.cbar_axes[i].set_ylabel(parameter)
 my_grid.cbar_axes[i].axis[right].toggle(ticklabels=True,
   label=True)





 [image: DPkWz.png]
 It looks like perhaps the colorbar axes is inside the ax axes rather than
 besides it?
 In the 
 demo_grid_with_each_cbarhttp://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_grid.htmlexample,
  how would you put a scale and label on the colorbar like in this
 plot:?
 [image: 58dFK.png]
 I can put a y_label on each contour plot, but since they all have depth,
 I'd like to label this only once.
 Is there a way to label the entire 

[Matplotlib-users] legend with

2009-12-04 Thread Chuck Pepe-Ranney
I am trying to plot a line area graph similar to a stacked bar chart.

E.g
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111)
ind = np.arange(3)
y1 = np.array([1,2,3])
y2 = y1 * 2
a = ax.fill_between(ind, y1, np.zeros(len(ind)), facecolor='r')
b = ax.fill_between(ind, y2, y1, facecolor='b')
plt.show()

However, when I try to make my legend,

ax.legend((a,b),('a','b'))

I get an AttributeError.  How do I extract the information I need from the
PolyCollection object to make a legend?
Thanks,

- Chuck
--
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Rotating X-Labels on AxesGrid?

2009-12-04 Thread Jae-Joon Lee
First of all, unless you're displaying multiple images (with aspect),
there is not much of benefit  of using axes_grid toolkit. So I
strongly recommend you to stick to subplot.


axes_grid toolkit uses different kind of artists to draw ticklabels.
Therefore, most of the matplotlib command that try to change the
properties of the ticklabels does not work.

http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html

http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/axislines.html

You may recover the original matplotlib behavior, but some of the
feature in axes_grid toolkit won't work.

http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisline

axes_grid way of rotating ticklabels is

   ax.axis[bottom].major_ticklabels.set_rotation(90)

But, you may want to fiddle with other properties also.

   ax.axis[bottom].major_ticklabels.set_va(top)
   ax.axis[bottom].major_tick_pad = -8

Anyhow, I must admit that handling of ticklabels in axes_grid toolkit
is a bit messy currently. And I hope to improve it soon.

Regards,

-JJ


On Fri, Dec 4, 2009 at 12:56 PM,  phob...@geosyntec.com wrote:
 Hey folks,

 I'm trying to make some bar plots using AxesGrid and the set_xlabels method 
 doesn't seem to notice that I'm passing a 'rotation' kwarg.

 Here's a small script that showing that this doesn't work:
 # --
 import matplotlib.pyplot as pl
 from mpl_toolkits.axes_grid import AxesGrid

 fig = pl.figure()
 grid = AxesGrid(fig, 111, nrows_ncols=(1,1), axes_pad=0.12)
 xlabs = ['paul', 'chris', 'patti']

 for ax in grid:
    ax.plot([1,2,3], [2,2.5,3], 'bo')
    ax.set_ylim([0,5])
    ax.set_xlim([0,4])
    ax.set_xticks([1,2,3])
    ax.set_xticklabels(xlabs, rotation=90)
 # -

 As you can see from the attached image, my labels aren't rotating. This is 
 obviously a trivial example, but I'm trying to plot some chemical 
 concentrations and the names are quite long.

 Any tips? Should I just be using subpolot instead?

 Python 2.6.2 and:
 In [25]: import matplotlib as mpl
 In [26]: mpl.__version__
 Out[26]: '0.99.1'
 In [27]: import numpy as np
 In [28]: np.__version__
 Out[28]: '1.3.0'

 Thanks!

 Paul M. Hobson
 Senior Staff Engineer
 --
 Geosyntec Consultants
 55 SW Yamhill St, Ste 200
 Portland, OR 97204
 Phone: (503) 222-9518
 www.geosyntec.com



 --
 Join us December 9, 2009 for the Red Hat Virtual Experience,
 a free event focused on virtualization and cloud computing.
 Attend in-depth sessions from your desk. Your couch. Anywhere.
 http://p.sf.net/sfu/redhat-sfdev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] AxesGrid problem.

2009-12-04 Thread Jae-Joon Lee
On Fri, Dec 4, 2009 at 2:49 PM, Ryan Neve ryan.n...@gmail.com wrote:

 Than you for your assistance with AxesGrid.

 Concerning the documentation, on this page:
 http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.htmit 
 says:
Name Default Description  aspect True aspect of axes
 then a few lines below:
 *aspect*By default (False), widths and heigths of axes in the grid are
 scaled independently. If True, they are scaled according to their data
 limits (similar to aspect parameter in mpl).

 **

Thanks a lot.
This need to be fixed.



 *Here is a more complete example of my code:
 *In the following code, x_grid and y_grid are are arrays created by
 meshgrid and represent time and water depth respectively.
 z_dim is a dictionary of one or more arrays of sensor readings
 corresponding to the depths and times in x_grid and y_grid.



Please, more complete example does not make any difference unless it is
complete.

Try the following code. This is based on the first part of your example. It
will show empty axes but without extra ticklabels. Again, I think an extra
axes is added to the figure somewhere in your code. And, without a complete,
runnable (but simple) code, there is not much I (or others) can help.

-JJ


from matplotlib import pyplot
from mpl_toolkits.axes_grid import AxesGrid

nrows = 3
DAP_figure = pyplot.figure(1,(20,8))
pyplot.figtext(0.05,.5,Depth
(m),rotation='vertical',verticalalignment='center')
# Create a grid of axes with the AxesGrid helper class
my_grid = AxesGrid(DAP_figure, 111, # Only one grid in this figure
nrows_ncols = (nrows,1), # one or more rows, but only one
column
axes_pad = 0.0, #pad between axes in inches
aspect=False, # If True, all plots are superimposed upon one
another.
add_all=True, # not sure why this would ever be False
share_all=True, # I think this means that all axes have the
same x  y scales
label_mode = L, # labels for depth on left and time on
bottom
cbar_location=right,
cbar_mode=each, # each axes has a different scale
cbar_size=2%,
cbar_pad=1%,
)

pyplot.draw()
pyplot.show()
--
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users