[Matplotlib-users] Matplotlib hi

2011-05-31 Thread zane . selvans
Matplotlib you won't be disappointed 
http://g.msn.com.br/BR9/1369.0?http://cnbc7.com/news

--
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] quiver() color arrays?

2009-08-07 Thread Zane Selvans
Hey there,

I'm trying to plot a bunch-o-vectors, colored red or blue, depending on
whether their magnitude is positive or negative (they represent stresses),
and I'm doing something like this:

mag1 = evals[:,0]
ex1  = evecs[:,0,1]
ey1  = evecs[:,0,0]
C1 = np.where(mag1 = 0, 'red', 'blue')

mag2 = evals[:,1]
ex2  = evecs[:,1,1]
ey2  = evecs[:,1,0]
C2 = np.where(mag2 = 0, 'red', 'blue')

basemap_ax.quiver(np.degrees(calc_phis), np.degrees(np.pi/2.0-calc_thetas),
mag1*ex1,  mag1*ey1, C1, lw=0, width=0.002, scale=1e8)
basemap_ax.quiver(np.degrees(calc_phis), np.degrees(np.pi/2.0-calc_thetas),
mag2*ex2,  mag2*ey2, C2, lw=0, width=0.002, scale=1e8)
basemap_ax.quiver(np.degrees(calc_phis), np.degrees(np.pi/2.0-calc_thetas),
-mag1*ex1, -mag1*ey1, C1, lw=0, width=0.002, scale=1e8)
basemap_ax.quiver(np.degrees(calc_phis), np.degrees(np.pi/2.0-calc_thetas),
-mag2*ex2, -mag2*ey2, C2, lw=0, width=0.002, scale=1e8)

And it gives me the stack trace below...  I also tried just using plain-old
quiver (not via basemap) and got the same error.  I tried using rgba tuples
and grayscale strings as colors as well, and still got the same error.
Anybody have any idea what the deal is?  Or am I misunderstanding what *C*
is supposed to be (i.e. not just an array of colors, of the same length as
the number of vectors being plotted...)

/Library/Python/2.5/site-packages/mpl_toolkits/basemap/__init__.pyc in
quiver(self, x, y, u, v, *args, **kwargs)
   2877 ax.hold(h)
   2878 try:
- 2879 ret =  ax.quiver(x,y,u,v,*args,**kwargs)
   2880 try:
   2881 plt.draw_if_interactive()

/Library/Python/2.5/site-packages/matplotlib/axes.pyc in quiver(self, *args,
**kw)
   5850 def quiver(self, *args, **kw):
   5851 if not self._hold: self.cla()
- 5852 q = mquiver.Quiver(self, *args, **kw)
   5853 self.add_collection(q, False)
   5854 self.update_datalim(q.XY)

/Library/Python/2.5/site-packages/matplotlib/quiver.pyc in __init__(self,
ax, *args, **kw)
367 **kw)
368 self.polykw = kw
-- 369 self.set_UVC(U, V, C)
370 self._initialized = False
371

/Library/Python/2.5/site-packages/matplotlib/quiver.pyc in set_UVC(self, U,
V, C)
439 mask = ma.mask_or(U.mask, V.mask, copy=False, shrink=True)
440 if C is not None:
-- 441 C = ma.masked_invalid(C, copy=False).ravel()
442 mask = ma.mask_or(mask, C.mask, copy=False, shrink=True)
443 if mask is ma.nomask:

/Library/Python/2.5/site-packages/numpy/ma/core.pyc in masked_invalid(a,
copy)
   1996 
   1997 a = np.array(a, copy=copy, subok=True)
- 1998 condition = ~(np.isfinite(a))
   1999 if hasattr(a, '_mask'):
   2000 condition = mask_or(condition, a._mask)

TypeError: bad operand type for unary ~: 'NotImplementedType'


-- 
Zane A. Selvans
Amateur Earthling
http://zaneselvans.org
+1 303 815 6866
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Wrong download link for MPL 0.99?

2009-08-06 Thread Zane Selvans
For some reason the download link on the Matplotlib pages is pointing to
Basemap 0.99.4 instead of Matplotlib 0.99.0.

I did a clean checkout of the v0_99_0 tag:

svn checkout
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/tags/v0_99_0

and built/installed it, and that seems to have gone okay.  Testing my
current batch of scripts with it.

The new stuff looks great!  I'm eagerly awaiting 1.0, whenever that comes.

Zane

-- 
Zane A. Selvans
Amateur Earthling
http://zaneselvans.org
+1 303 815 6866
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axes.frame vs. Axes.spines in SVN Basemap and Matplotlib? (was New contourf()...)

2009-06-16 Thread Zane Selvans
Yep, looks like the trunk has fixed the contourf() issue.

Unfortunately there also seems to be some new incompatibility with the
Basemap toolkit, even after re-installing Basemap from source.  I get:

AttributeError: Axes.frame was removed in favor of Axes.spines

when I attempt to call:

drawmapboundary(fill_color=white)

Error output below:

/Users/zane/svn/googlecode/satstress/satstress/nsrhist.pyc in
makefigs(dbar_max, maps, hists, examples, stats, stress, tpw,
lindensity, all, save_format)
774 if maps is True: #{{{2
775 print(Plotting Mapped Lineaments, fit to NSR stresses)
-- 776 FitMap(nsrlins, nbins=9, titlestr=global lins, fit to
NSR, dbar_max=dbar_max, outfile=figure_outfiles['FitMap_Mapped'])
777 print(Plotting Pre-TPW Lineaments, fit to NSR stresses)
778 FitMap(tpwlins, nbins=9, titlestr=pre-TPW lins, fit
to NSR, dbar_max=dbar_max, outfile=figure_outfiles['FitMap_PreTPW'])

/Users/zane/svn/googlecode/satstress/satstress/nsrhist.pyc in
FitMap(lins, titlestr, lin_cm, nbins, stresscentric, outfile,
dbar_max, showbad, derotate)
   1005 linfitmap.drawmeridians(range(llcrnrlon,urcrnrlon+1,gridspace),
labels=[1,0,0,1])
   1006 linfitmap.drawparallels(range(llcrnrlat,urcrnrlat+1,gridspace),
labels=[1,0,0,1])
- 1007 linfitmap.drawmapboundary(fill_color=white)
   1008 map_ax = fig.axes[0]
   1009

/Library/Python/2.5/site-packages/mpl_toolkits/basemap/__init__.pyc in
drawmapboundary(self, color, linewidth, fill_color, zorder, ax)
   1263 else: # all other projections are rectangular.
   1264 # use axesPatch for fill_color, frame for border line props.
- 1265 ax.frame.set_linewidth(linewidth)
   1266 if self.projection not in ['geos','ortho']:
   1267 if fill_color is not None:

/Library/Python/2.5/site-packages/matplotlib/axes.pyc in get_frame(self)
984
985 def get_frame(self):
-- 986 raise AttributeError('Axes.frame was removed in favor
of Axes.spines')
987 frame = property(get_frame)
988

AttributeError: Axes.frame was removed in favor of Axes.spines

In [3]: import mpl_toolkits.basemap

In [4]: mpl_toolkits.basemap.__version__
Out[4]: '0.99.4'


On Tue, Jun 16, 2009 at 7:29 AM, Michiel de Hoonmjldeh...@yahoo.com wrote:

 I can't reproduce this error with the current code in SVN trunk, but I 
 remember seeing this bug a while ago. So I'm guessing that this bug has 
 already been fixed in SVN. Zane, could you try installing the latest 
 matplotlib from trunk and see if you still see this bug?

 --Michiel

 --- On Mon, 6/15/09, Michael Droettboom md...@stsci.edu wrote:

 From: Michael Droettboom md...@stsci.edu
 Subject: Re: [Matplotlib-users] New contourf() drawing polygon boundaries 
 for  some reason?
 To: z...@amateurearthling.org, matplotlib-users 
 matplotlib-users@lists.sourceforge.net, Michiel de Hoon 
 mjldeh...@yahoo.com
 Date: Monday, June 15, 2009, 6:08 PM






 Thanks for the thorough investigation.



 Michiel: can you look into why the macosx backend is
 drawing the
 strokes around the polygons?  Probably as simple as
 inadvertently
 ignoring an argument.



 I'll look into the path simplification-related issues.



 Cheers,

 Mike



 On 06/15/2009 03:29 PM, Zane Selvans wrote:

   Yes.  By far the worst of these behaviors is the
 macosx GUI output.  I
 could see the other ones just being the way it's
 supposed to look.
 Here's a summary:

 backend: macosx; path.simplify: (false|true) GUI =
 black borders to
 drawn polygons (incl. contour region crossing lines, very
 bad)
 http://zaneselvans.org/dropbox/contourf_backendmacosx.png

 backend: agg (PNG output) path.simplify: (true|false) =
 somewhat
 visible borders between polygons (esp. adjacent to
 contrasting colors)
 http://zaneselvans.org/dropbox/contourf_simplifytrue.png
 http://zaneselvans.org/dropbox/contourf_simplifyfalse.png

 backend: pdf (PDF output) path.simplify: true =
 reliably visible
 irregularities (but probably this is somewhat expected with
 SVG
 output)
 http://zaneselvans.org/dropbox/contourf_simplifytrue.pdf

 backend: pdf (PDF output) path.simplify: false =
 infinitessimally
 thin lines of background color visible between contour
 filled regions.
 http://zaneselvans.org/dropbox/contourf_simplifyfalse.pdf

 And here's what I used to generate them:

 def broken_contourf():
     
     Simple demonstration that filled contour plots are
 broken.

     Looking at the PDF and PNG output using the macosx
 backend, everything is
     fine.  It's only the GUI output which is for some
 reason outlining the
     polygons in the filled contours.

     
     from numpy.random import uniform, seed
     from matplotlib.mlab import griddata
     import matplotlib.pyplot as plt
     import numpy as np
     # make up data.
     #npts = int(raw_input('enter # of random points to
 plot:'))
     seed(-1)
     npts = 200
     x = uniform(-2,2,npts)
     y = uniform(-2,2,npts

Re: [Matplotlib-users] New contourf() drawing polygon boundaries for some reason?

2009-06-15 Thread Zane Selvans
Yes.  By far the worst of these behaviors is the macosx GUI output.  I
could see the other ones just being the way it's supposed to look.
Here's a summary:

backend: macosx; path.simplify: (false|true) GUI = black borders to
drawn polygons (incl. contour region crossing lines, very bad)
http://zaneselvans.org/dropbox/contourf_backendmacosx.png

backend: agg (PNG output) path.simplify: (true|false) = somewhat
visible borders between polygons (esp. adjacent to contrasting colors)
http://zaneselvans.org/dropbox/contourf_simplifytrue.png
http://zaneselvans.org/dropbox/contourf_simplifyfalse.png

backend: pdf (PDF output) path.simplify: true = reliably visible
irregularities (but probably this is somewhat expected with SVG
output)
http://zaneselvans.org/dropbox/contourf_simplifytrue.pdf

backend: pdf (PDF output) path.simplify: false = infinitessimally
thin lines of background color visible between contour filled regions.
http://zaneselvans.org/dropbox/contourf_simplifyfalse.pdf

And here's what I used to generate them:

def broken_contourf():

Simple demonstration that filled contour plots are broken.

Looking at the PDF and PNG output using the macosx backend, everything is
fine.  It's only the GUI output which is for some reason outlining the
polygons in the filled contours.


from numpy.random import uniform, seed
from matplotlib.mlab import griddata
import matplotlib.pyplot as plt
import numpy as np
# make up data.
#npts = int(raw_input('enter # of random points to plot:'))
seed(-1)
npts = 200
x = uniform(-2,2,npts)
y = uniform(-2,2,npts)
z = x*np.exp(-x**2-y**2)
# define grid.
xi = np.linspace(-2.1,2.1,100)
yi = np.linspace(-2.1,2.1,100)
# grid the data.
zi = griddata(x,y,z,xi,yi)
# contour the gridded data, plotting dots at the nonuniform data points.
CS = plt.contourf(xi,yi,zi,15,cmap=plt.cm.jet)
# plot data points.
plt.title('griddata() and contourf() test')
plt.savefig('broken_contourf.pdf')
plt.savefig('broken_contourf.png')

On Fri, Jun 12, 2009 at 3:02 PM, Zane Selvansz...@ideotrope.org wrote:
 I switched back to using the macosx backend, and it turns out that the
 thin black lines surrounding the polygons (including crossing the
 filled contour regions from one closed contour to another) only get
 displayed in the GUI.  PDF and PNG output look fine.

 Zane

 On Fri, Jun 12, 2009 at 2:27 PM, Zane Selvansz...@ideotrope.org wrote:
 If I set path.simplify: False, the shape of the gaps between the
 filled polygons does change.  Instead of being irregular, it becomes
 an infinitessimally thin gap of uniform width, allowing the (in this
 case white) background to show through.

 In both of these cases (path.simplify: True|False), the PNG version of
 the same figures also show representations of these gaps which are
 identical to those which appear in the PDF (though obviously
 pixelated), so I don't think it's something that's wrong in the vector
 graphics code per se.

 Zane

 On Fri, Jun 12, 2009 at 11:46 AM, Michael Droettboommd...@stsci.edu wrote:
 Shot in the dark here, but what if you set the rcParam path.simplify to
 False?  There have been recent changes to that code.

 Also, since the Agg backend doesn't have an associated GUI, you need to use
 the savefig() command and provide a filename, rather than using show().

 Cheers,
 Mike

 Zane Selvans wrote:

 Um, yeah.  So my response got bounced because of the attachment.  Take 2:

 For some reason my script bombed when I switched to the Agg backend,
 trying to display to the screen (it said Figure has no method show())

 So I output the plot as both a PDF and a PNG (still having backend:
 agg in my rcfile) and in both of those cases, irregular gaps are
 visible between the polygons making up the filled contours.  This
 wasn't the case with my previously installed setup.  It looks as if
 for some reason the vertices of the filled polygons are being
 calculated differently from different sides of the same contour,
 leading to overlap in some places, and gaps in others.  You can download
 the PDF version (in which the exact geometry is much clearer).
 from:

 http://zaneselvans.org/dropbox/LinDensity_Grid.pdf

 Zane

 On Fri, Jun 12, 2009 at 5:51 AM, Michael Droettboommd...@stsci.edu
 wrote:


 So you see this behavior if you switch to the Agg backend?  That's the
 backend used to generate the images in the gallery.  If there's a
 difference
 there, that would seem to suggest some tweaking of the macosx backend
 (which
 is still relatively new) is in order.

 Mike

 Zane Selvans wrote:


 I just installed the latest SciPy Superpack in order to get access to
 the scipy.spatial.KDTree class, and discovered that for some reason
 now when I use contourf() lines get drawn at the boundaries between
 the filled contours.  Additionally, there is always a single vertical
 line crossing from each contour boundary to the next.  I'm guessing

Re: [Matplotlib-users] Quiver plot of a netcdf file

2009-06-15 Thread Zane Selvans

Okay, so in the variables section, what you've got is a list of things
which vary as a function of the dimensions listed in the previous section
(time, nsr_delta, lat, lon).  I don't remember which of the NetCDF file
reading libraries you're using, but using Jeff's older netCDF3 interface,
you could do something like:

nc_in = netCDF3.Dataset(outputfile.nc)

And then that nc_in thing contains all the data that's contained in the file
outputfile.nc, and you can read it into numpy arrays:

Ttt_D = nc_in.variables['Ttt_D'][:,:,:]
Tpt_D = nc_in.variables['Tpt_D'][:,:,:]
Tpp_D = nc_in.variables['Tpp_D'][:,:,:]

What that does is stick the north-south, shear, and east-west components of
the Diurnal stresses into the three arrays.  The [:,:,:] bit says give me
the data for all values of time, latitude and longitude.

In order to turn those tensor components into the principal components, you
need to, for each (t,lat,lon) set, diagonalize the matrices composed of the
stress values:

[ [ Ttt(t,lat,lon), Tpt(t,lat,lon) ],
  [ Tpt(t,lat,lon), Tpp(t,lat,lon) ] ]

which you can do with np.eig()

The (unit length) eigenvectors it returns will tell you what direction the
principal components point, and the corresponding eigenvalues will tell you
their magnitudes... which then have to get fed in to quiver().

Hopefully that helps at least a little?


JPKay wrote:
 
 Hello, 
 
 Now that I have correctly imported the NetCDF file and set up the kind of
 projection I am interested in having the data displayed over I am having
 trouble plotting my data with the quiver function. I am interested in
 plotting the principal vectors of the stress field onto a Mercator
 projection. 
 My netcdf file is telling me the following after ncdump -h
 dimensions:
   nsr_delta = 20 ;
   time = 24 ;
   latitude = 37 ;
   longitude = 73 ;
 variables:
   float nsr_delta(nsr_delta) ;
   nsr_delta:units =  ;
   nsr_delta:long_name = NSR Surface Delta (mu/(eta*omega)) ;
   float time(time) ;
   time:units = degrees ;
   time:long_name = degrees after periapse ;
   float latitude(latitude) ;
   latitude:units = degrees_north ;
   latitude:long_name = latitude ;
   float longitude(longitude) ;
   longitude:units = degrees_east ;
   longitude:long_name = longitude ;
   float Ttt_D(time, latitude, longitude) ;
   Ttt_D:units = Pa ;
   Ttt_D:long_name = north-south component stress of Diurnal 
 stresses ;
   float Tpt_D(time, latitude, longitude) ;
   Tpt_D:units = Pa ;
   Tpt_D:long_name = shear component of Diurnal stresses ;
   float Tpp_D(time, latitude, longitude) ;
   Tpp_D:units = Pa ;
   Tpp_D:long_name = east-west component of Diurnal stresses ;
   float Ttt_N(nsr_delta, latitude, longitude) ;
   Ttt_N:units = Pa ;
   Ttt_N:long_name = north-south component of NSR stresses ;
   float Tpt_N(nsr_delta, latitude, longitude) ;
   Tpt_N:units = Pa ;
   Tpt_N:long_name = shear component of NSR stresses ;
   float Tpp_N(nsr_delta, latitude, longitude) ;
   Tpp_N:units = Pa ;
   Tpp_N:long_name = east-west component of NSR stresses ;
 
 // global attributes:
   :description = Testing pySatStress on a regular grid ;
   :history = Created: Mon Jun 15 12:46:13 2009 using 
 pySatStress ;
   :Conventions = COARDS ;
 However, when I am strugglingto use the quiver_demo.py as a guide to
 making my quiver plot. 
 Thanks for any help you can offer. 
 Jon 
 
 

-- 
View this message in context: 
http://www.nabble.com/Quiver-plot-of-a-netcdf-file-tp23986313p24046177.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] New contourf() drawing polygon boundaries for some reason?

2009-06-12 Thread Zane Selvans
Um, yeah.  So my response got bounced because of the attachment.  Take 2:

For some reason my script bombed when I switched to the Agg backend,
trying to display to the screen (it said Figure has no method show())

So I output the plot as both a PDF and a PNG (still having backend:
agg in my rcfile) and in both of those cases, irregular gaps are
visible between the polygons making up the filled contours.  This
wasn't the case with my previously installed setup.  It looks as if
for some reason the vertices of the filled polygons are being
calculated differently from different sides of the same contour,
leading to overlap in some places, and gaps in others.  You can download
the PDF version (in which the exact geometry is much clearer).
from:

http://zaneselvans.org/dropbox/LinDensity_Grid.pdf

Zane

On Fri, Jun 12, 2009 at 5:51 AM, Michael Droettboommd...@stsci.edu wrote:
 So you see this behavior if you switch to the Agg backend?  That's the
 backend used to generate the images in the gallery.  If there's a difference
 there, that would seem to suggest some tweaking of the macosx backend (which
 is still relatively new) is in order.

 Mike

 Zane Selvans wrote:

 I just installed the latest SciPy Superpack in order to get access to
 the scipy.spatial.KDTree class, and discovered that for some reason
 now when I use contourf() lines get drawn at the boundaries between
 the filled contours.  Additionally, there is always a single vertical
 line crossing from each contour boundary to the next.  I'm guessing
 that these are the edges of the filled polygons which are getting
 drawn.  This behavior doesn't seem to be consistent with the
 contourf() documentation and when I run code in griddata_demo.py it
 doesn't come out looking like the picture in the documentation/example
 gallery...

 Is anyone else seeing this behavior?  Is there a keyword I can use to
 force the edges of the polygons not to get drawn?

 This is on Mac OS X 10.5.7, with
 scipy.__version__ = 0.8.0.dev5635
 matplotlib.__version__ = 0.98.6svn
 numpy.__version__=1.4.0.dev6728

 As installed by superpack_2009.03.28.sh
 from http://macinscience.org/?page_id=6

 using:
 backend: macosx

 Cheers,
 Zane



 --
 Michael Droettboom
 Science Software Branch
 Operations and Engineering Division
 Space Telescope Science Institute
 Operated by AURA for NASA





-- 
Zane A. Selvans
Amateur Earthling
http://zaneselvans.org
+1 303 815 6866

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] New contourf() drawing polygon boundaries for some reason?

2009-06-12 Thread Zane Selvans
If I set path.simplify: False, the shape of the gaps between the
filled polygons does change.  Instead of being irregular, it becomes
an infinitessimally thin gap of uniform width, allowing the (in this
case white) background to show through.

In both of these cases (path.simplify: True|False), the PNG version of
the same figures also show representations of these gaps which are
identical to those which appear in the PDF (though obviously
pixelated), so I don't think it's something that's wrong in the vector
graphics code per se.

Zane

On Fri, Jun 12, 2009 at 11:46 AM, Michael Droettboommd...@stsci.edu wrote:
 Shot in the dark here, but what if you set the rcParam path.simplify to
 False?  There have been recent changes to that code.

 Also, since the Agg backend doesn't have an associated GUI, you need to use
 the savefig() command and provide a filename, rather than using show().

 Cheers,
 Mike

 Zane Selvans wrote:

 Um, yeah.  So my response got bounced because of the attachment.  Take 2:

 For some reason my script bombed when I switched to the Agg backend,
 trying to display to the screen (it said Figure has no method show())

 So I output the plot as both a PDF and a PNG (still having backend:
 agg in my rcfile) and in both of those cases, irregular gaps are
 visible between the polygons making up the filled contours.  This
 wasn't the case with my previously installed setup.  It looks as if
 for some reason the vertices of the filled polygons are being
 calculated differently from different sides of the same contour,
 leading to overlap in some places, and gaps in others.  You can download
 the PDF version (in which the exact geometry is much clearer).
 from:

 http://zaneselvans.org/dropbox/LinDensity_Grid.pdf

 Zane

 On Fri, Jun 12, 2009 at 5:51 AM, Michael Droettboommd...@stsci.edu
 wrote:


 So you see this behavior if you switch to the Agg backend?  That's the
 backend used to generate the images in the gallery.  If there's a
 difference
 there, that would seem to suggest some tweaking of the macosx backend
 (which
 is still relatively new) is in order.

 Mike

 Zane Selvans wrote:


 I just installed the latest SciPy Superpack in order to get access to
 the scipy.spatial.KDTree class, and discovered that for some reason
 now when I use contourf() lines get drawn at the boundaries between
 the filled contours.  Additionally, there is always a single vertical
 line crossing from each contour boundary to the next.  I'm guessing
 that these are the edges of the filled polygons which are getting
 drawn.  This behavior doesn't seem to be consistent with the
 contourf() documentation and when I run code in griddata_demo.py it
 doesn't come out looking like the picture in the documentation/example
 gallery...

 Is anyone else seeing this behavior?  Is there a keyword I can use to
 force the edges of the polygons not to get drawn?

 This is on Mac OS X 10.5.7, with
 scipy.__version__ = 0.8.0.dev5635
 matplotlib.__version__ = 0.98.6svn
 numpy.__version__=1.4.0.dev6728

 As installed by superpack_2009.03.28.sh
 from http://macinscience.org/?page_id=6

 using:
 backend: macosx

 Cheers,
 Zane




 --
 Michael Droettboom
 Science Software Branch
 Operations and Engineering Division
 Space Telescope Science Institute
 Operated by AURA for NASA








 --
 Michael Droettboom
 Science Software Branch
 Operations and Engineering Division
 Space Telescope Science Institute
 Operated by AURA for NASA





-- 
Zane A. Selvans
Amateur Earthling
http://zaneselvans.org
+1 303 815 6866

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] New contourf() drawing polygon boundaries for some reason?

2009-06-12 Thread Zane Selvans
I switched back to using the macosx backend, and it turns out that the
thin black lines surrounding the polygons (including crossing the
filled contour regions from one closed contour to another) only get
displayed in the GUI.  PDF and PNG output look fine.

Zane

On Fri, Jun 12, 2009 at 2:27 PM, Zane Selvansz...@ideotrope.org wrote:
 If I set path.simplify: False, the shape of the gaps between the
 filled polygons does change.  Instead of being irregular, it becomes
 an infinitessimally thin gap of uniform width, allowing the (in this
 case white) background to show through.

 In both of these cases (path.simplify: True|False), the PNG version of
 the same figures also show representations of these gaps which are
 identical to those which appear in the PDF (though obviously
 pixelated), so I don't think it's something that's wrong in the vector
 graphics code per se.

 Zane

 On Fri, Jun 12, 2009 at 11:46 AM, Michael Droettboommd...@stsci.edu wrote:
 Shot in the dark here, but what if you set the rcParam path.simplify to
 False?  There have been recent changes to that code.

 Also, since the Agg backend doesn't have an associated GUI, you need to use
 the savefig() command and provide a filename, rather than using show().

 Cheers,
 Mike

 Zane Selvans wrote:

 Um, yeah.  So my response got bounced because of the attachment.  Take 2:

 For some reason my script bombed when I switched to the Agg backend,
 trying to display to the screen (it said Figure has no method show())

 So I output the plot as both a PDF and a PNG (still having backend:
 agg in my rcfile) and in both of those cases, irregular gaps are
 visible between the polygons making up the filled contours.  This
 wasn't the case with my previously installed setup.  It looks as if
 for some reason the vertices of the filled polygons are being
 calculated differently from different sides of the same contour,
 leading to overlap in some places, and gaps in others.  You can download
 the PDF version (in which the exact geometry is much clearer).
 from:

 http://zaneselvans.org/dropbox/LinDensity_Grid.pdf

 Zane

 On Fri, Jun 12, 2009 at 5:51 AM, Michael Droettboommd...@stsci.edu
 wrote:


 So you see this behavior if you switch to the Agg backend?  That's the
 backend used to generate the images in the gallery.  If there's a
 difference
 there, that would seem to suggest some tweaking of the macosx backend
 (which
 is still relatively new) is in order.

 Mike

 Zane Selvans wrote:


 I just installed the latest SciPy Superpack in order to get access to
 the scipy.spatial.KDTree class, and discovered that for some reason
 now when I use contourf() lines get drawn at the boundaries between
 the filled contours.  Additionally, there is always a single vertical
 line crossing from each contour boundary to the next.  I'm guessing
 that these are the edges of the filled polygons which are getting
 drawn.  This behavior doesn't seem to be consistent with the
 contourf() documentation and when I run code in griddata_demo.py it
 doesn't come out looking like the picture in the documentation/example
 gallery...

 Is anyone else seeing this behavior?  Is there a keyword I can use to
 force the edges of the polygons not to get drawn?

 This is on Mac OS X 10.5.7, with
 scipy.__version__ = 0.8.0.dev5635
 matplotlib.__version__ = 0.98.6svn
 numpy.__version__=1.4.0.dev6728

 As installed by superpack_2009.03.28.sh
 from http://macinscience.org/?page_id=6

 using:
 backend: macosx

 Cheers,
 Zane




 --
 Michael Droettboom
 Science Software Branch
 Operations and Engineering Division
 Space Telescope Science Institute
 Operated by AURA for NASA








 --
 Michael Droettboom
 Science Software Branch
 Operations and Engineering Division
 Space Telescope Science Institute
 Operated by AURA for NASA





 --
 Zane A. Selvans
 Amateur Earthling
 http://zaneselvans.org
 +1 303 815 6866




-- 
Zane A. Selvans
Amateur Earthling
http://zaneselvans.org
+1 303 815 6866

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] New contourf() drawing polygon boundaries for some reason?

2009-06-11 Thread Zane Selvans
I just installed the latest SciPy Superpack in order to get access to
the scipy.spatial.KDTree class, and discovered that for some reason
now when I use contourf() lines get drawn at the boundaries between
the filled contours.  Additionally, there is always a single vertical
line crossing from each contour boundary to the next.  I'm guessing
that these are the edges of the filled polygons which are getting
drawn.  This behavior doesn't seem to be consistent with the
contourf() documentation and when I run code in griddata_demo.py it
doesn't come out looking like the picture in the documentation/example
gallery...

Is anyone else seeing this behavior?  Is there a keyword I can use to
force the edges of the polygons not to get drawn?

This is on Mac OS X 10.5.7, with
scipy.__version__ = 0.8.0.dev5635
matplotlib.__version__ = 0.98.6svn
numpy.__version__=1.4.0.dev6728

As installed by superpack_2009.03.28.sh
from http://macinscience.org/?page_id=6

using:
backend: macosx

Cheers,
Zane

-- 
Zane A. Selvans
Amateur Earthling
http://zaneselvans.org
+1 303 815 6866

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] least squares fitting of great circle to points on a sphere

2009-04-21 Thread Zane Selvans
On Fri, Aug 8, 2008 at 10:35 AM, Charles R Harris
charlesr.har...@gmail.com wrote:


 On Mon, Aug 4, 2008 at 11:48 AM, Zane Selvans z...@ideotrope.org wrote:

 Does anyone out there happen to know a simple algorithm for least
 squares fitting a great circle to a given set of lat/lon points on a
 sphere?  Seems like it might not be a crazy thing to add to the library.


 Depends on whether you need distance along the sphere surface or not. But if
 you can deal with saggital distances it reduces to an eigenvalue problem.
 Represent the great circle by a unit vector u perpindicular to the plane
 that determined by the great circle, then minimize the sum

 \sum_{i=1}^{n} |dot(u,x_i)|^2

 which you can rewrite by setting

 A = \sum_{i=1}^{n} (x_i * x^T_i)

 so that you end up minimizing

 u^T * A * u

 subject to the constraint u^T * u = 1. The vector u is then the eigenvector
 corresponding to the smallest eigenvalue of A.

 Chuck

I finally ended up needing to implement great circle fitting, and went
ahead and implemented the suggestion below (yes, more than 8 months
later...).  I don't think it's quite right though.  The quantity to
minimize is u^T*A*u, but doing so doesn't make u one of the
eigenvectors of A, does it?

I generated a perfect great circle segment (as a series of lon,lat
points using spherical reckoning) and found its corresponding pole
(good_u) by going pi/2 radians away from it on the sphere,
perpendicular to its path.

I also converted the series of lon,lat points into x,y,z vectors (on
the unit sphere), and constructed A as:

In [552]: A = dot(array([x,y,z]),array([x,y,z]).transpose())

and then found the eigenvalues/vectors:

In [553]: eigvals_A, eigvecs_A = eig(A)

and none of them corresponds to the good_u which I found above, and
they don't minimize the product:

In [554]: [ dot(dot(eigvecs_A[N],A),eigvecs_A[N].transpose()) for N in
range(3) ]
Out[554]: [42.058431684800112, 25.787798426739176, 22.153769888460737]

whereas good_u does.

In [555]: dot(dot(good_u,A),good_u.transpose())
Out[555]: -5.9120729242764932e-15

Have I misunderstood something here?  It's not immediately obvious to
me why choosing u such that it minimizes u^T * A * u would make it an
eigenvector of A.  It has been a long time since I took linear algebra
though...

Thanks for any insights,
Zane

-- 
Zane A. Selvans
Amateur Earthling
http://zaneselvans.org
+1 303 815 6866

--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] mathtext acting weird under macosx backend

2008-12-18 Thread Zane Selvans
First, *thank you* to whoever did the Mac OS X backend.  It's much  
faster and smoother, and seems to behave much more reasonably all  
around.  As in, show() actually does what it says it's supposed to do,  
and the figures don't have to be re-sized to draw themselves!


However, there seems to be some kind of strangeness with using  
mathtext.  When an axis label, tick label, title, or other text has  
any mathtext embedded within it, the font that the entire text object  
is rendered in changes, becoming larger, and often fuzzier (in an anti- 
aliased kind of way).


On the plus (though confusing) side, the ticklabels that are being  
output by the basemap toolkit are now the same size as all my normal  
ticklabels, even though they appear to contain a mathtext character  
(the ^\circ for the degrees symbol), whereas previously, all the  
basemap ticklabels were coming out larger than the rest of my  
ticklabels, and I didn't seem to be able to alter them in the normal  
text object manipulation ways.


I'm running on:
Matplotlib SVN: v6677
Mac OS 10.5.6
macosx backend
python 2.5.1
ipython 0.9.1

After I noticed this the first time, I quit out of the interpreter,  
and deleted the font cache from my .matplotlib directory, restarted,  
and the problem persisted.


Any suggestions?  I don't have any of the alternate tex rendering  
options set in my rcfile, just using plain mathtext.


--
Zane Selvans
Amateur Earthling
z...@ideotrope.org
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Legends for multi-histograms

2008-12-10 Thread Zane Selvans
It seems like there ought to be an easy way to associate labels with  
the various groups of patches generated by a call to hist() that uses  
a list of arrays, setting label=[a, list, of, strings] for  
instance, instead of having to go in and label one patch from each  
returned list of patches afterward.  Would make legend creation easier  
anyway.


Just a suggestion,
Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Unable to manipulate tick labels Basemap

2008-11-26 Thread Zane Selvans
I want to change the size of the lat/lon labels on a Basemap map, and  
from the documentation, it seems like this ought to be possible using  
drawparallels() and drawmeridians() with a keword argument, e.g.:


linmap.drawparallels(range(-90,90,30), labels=[1,0,0,1], fontsize='x- 
small')


but that doesn't have any effect.  I've also tried size='x-small' and  
size/fontsize=9 and none of them seem to do anything.  I also can't  
seem to obtain lists of ticklabels from the Axes instance that the map  
is inside of, to change their sizes.  On normal (non-Basemap) figures,  
I can do something like:


for ticklabel in ax.get_xticklabels():
ticklabel.set_size('x-small')

to re-size them after the fact, but on the Basemap axes,  
get_xticklabels() returns a zero length list.


Does anybody know where are these things hiding?

Thanks!
Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Plotting w/ cyclic boundaries

2008-11-26 Thread Zane Selvans
Does anybody have a good method for implementing cyclic boundaries in  
matplotlib axes?


It's easy when plotting points to just mod() the values before sending  
them to the plot, but when drawing lines or patches, it would be nice  
if there were an underlying mechanism for intelligently splitting the  
patch or line when it runs off the edge (instead of either not seeing  
it, or calling mod() and getting the mess of lines dragged all the way  
across the plot to where they continue on the other side).  I'd use  
this primarily for global-scale maps in Basemap... but I could see it  
being more generally useful when dealing with a periodic space where  
what you're interested in is the phase.


Or maybe this already exists and I'm just not seeing it?

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Problems with, LaTeX symbols, axes rescaling

2008-11-24 Thread Zane Selvans
Yesterday I compiled Matplotlib from SVN, and installed it to run on  
top of the dependencies that I have installed from the SciPy Superpack  
for OS X from Chris Fonnesbeck.  Nearly everything seems to be working  
fine.  However, there are a couple of glitches, and I can't tell  
whether it's because of something being out of sync between all my  
installed bits, or whether it's just the fact that I'm using the SVN  
code.


The first thing I noticed is that all of the LaTeX symbols I have in  
my plots are now messed up.  I could see this being a font issue...  
does anyone know how/where Matplotlib gets pointed at the LaTeX  
fonts?  And how I would check to see where it's looking, or whether  
it's not finding what it's looking for?  I'm not getting any errors -  
my greek letters just cease to be greek, and various text decorations  
(like \bar{D}) come out as other things altogether (like D, only with  
an Angstrom symbol over it...).


The second thing is that in a figure in which I'm using twinx() to  
create a separate y-axis using the same x-axis, I no longer seem to be  
able to control the limits of the new axes.  They just automatically  
re-scale to fit whatever data is being plotted, regardless of whether  
I use ax.set_ylim().


Third, and this was a problem before I did the re-compile, and it  
remains so, often (but not always) my figures refuse to draw  
completely, until I've re-sized the window in which they're being  
displayed.  This happens even when I do a figure.show() at the end of  
the script.  Some of the lines will draw, but not all of them.  Is  
this a familiar problem?


Thanks for any suggestions...

Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems with, LaTeX symbols, axes rescaling

2008-11-24 Thread Zane Selvans


On Nov 24, 2008, at 5:23 PM, John Hunter wrote:

The first thing I noticed is that all of the LaTeX symbols I have  
in my
plots are now messed up.  I could see this being a font issue...  
does anyone



I suggest completely wiping your .matplotlib directory (saving only
your matplotlibrc if you have customized it).  matplotlib caches a


Thanks, this fixed it!

Though, futzing with the LaTeX settings in the new matplotlibrc it  
appears that something about how/when it chooses when to format as tex  
has changed.  If text.usetex is True, text in my labels and titles  
that is enclosed within $$'s gets typeset as tex, but apparently *all*  
of the xtick labels get set as mathtext - they're in the light/thin  
and slightly more difficult to read LaTeX font, and in my Basemap  
figures, the NSEW modifiers on the text objects indicating lat/lon  
direction are all italicised, as they would be were they enclosed in $ 
$'s.  I don't seem to be able to get the relatively bold, sans-serif  
tick labels, while still preserving the ability to typeset math in my  
labels and titles...


(An aside: how does one go about decorating the Text objects that  
label the ticks?  I frequently have an axis whose units are degrees,  
and I'd rather just be able to append a $^\circ$ on the end of the  
text for the ticks, rather than have to say in the axis label  
[degrees].)


If I set text.markup to 'tex', instead of 'plain' I get a complaint  
about it being invalid, with a pointer to a URL that no longer exists  
to obtain a new matplotlibrc:


Bad key text.markup on line 162 in /Users/zane/.matplotlib/ 
matplotlibrc.
You probably need to get an updated matplotlibrc file from http://matplotlib.sf.net/matplotlibrc 
 or from the matplotlib source distribution


Thanks again!
Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems with LaTeX symbols

2008-11-24 Thread Zane Selvans

We have two modes to render latex -- one is native TeX layout and uses
latex and dvipng, and is superior if you need all of TeX's
capabilities (eg an eqnarray), but the fonts are suboptimal.  The
other is mathtext, which will cover 98% of most users' math needs,
does not require a latex install because it is pure mpl, and uses
nicer fonts .


Well, if I turn off usetex, then the LaTeX symbols don't get rendered  
correctly.  It's obviously trying to do something other than just  
write out the plain text, but it's not doing the right thing.  I quit  
out of matplotlib, and re-purged all the cached stuff from  
my .matplotlib directory, and it's still failing.  From the docs, it  
sounds like mathtext is just the default way for Text objects to get  
rendered.  It fails the same way irrespective of whether I use a raw  
string, or a double-quoted string:


fit_ax.set_ylabel(r'$\delta_{rms}$ [degrees]')
fit_ax.set_ylabel($\delta_{rms}$ [degrees])

both give a capital 'C' with a subscript 'rms'

$\bar{D}$ results in a capital D with a little circle over it.

$20^\circ$ yields 20 raised to the little tiny 'e' power.

Even if I wipe my site-packages/matplotlib* directory and egg-info,  
make clean, and recompile and install matplotlib from the SVN source,  
I still get the same problem.  I don't know if it means anything, but  
I note that the mpl-data/fonts directory in SVN has 282 sub-entries,  
and the mpl-data/fonts directory that's getting installed in my site- 
packages only has 99 sub-entries.  But maybe they aren't supposed to  
be the same?  Dunno.


So for now I can only get my math symbols to render with text.usetext  
turned on.


I'll read up on the text formatters.  Thanks for all your help!

Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Filling between curves conditionally

2008-11-23 Thread Zane Selvans

On Nov 23, 2008, at 12:36 PM, John Hunter wrote:

On Sun, Nov 23, 2008 at 1:26 PM, John Hunter [EMAIL PROTECTED]  
wrote:



The code is much simpler than the fill_between_posneg original
example, which I have just removed from svn.


The fill between use case is common enough that I decided to make it
an axes/pyplot method.  No need to use the intermediate
mlab.poly_between anymore.  fill_between has signature::



Sigh.

I've never been able to get the whole SciPy dependency mess to  
successfully build from source, so I'm running from the OS X Superpack  
that Chris Fonnesbeck puts out at http://macinscience.org   
Unfortunately some of the versions of stuff being pulled in there are  
kind of stale it looks like.


Maybe I should give it another go from source or pre-built SVN  
binaries.  Has it gotten any easier lately?


Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Filling between curves conditionally

2008-11-23 Thread Zane Selvans

 Either way, it's
pretty straightforward; just change one line in the Python Makefile
and matplotlib will install with a simple sudo python setup.py
install


Huh, well there was a make target for Leopard that had that fixed  
CFLAGS that you suggested, and it seemed to build and install without  
any major complaints.  If I rename the Matplotlib directory that was  
installed by the SciPy superpack, and try to fire up ipython -pylab,  
it seems to work!  Woo hoo!


It looks like there's a tiny doc bug here: 
http://matplotlib.sourceforge.net/examples/pylab_examples/fill_between.html

ax = fig.add_subplot(111)
ax1.plot(x, y1, x, y2, color='black')
ax.fill_between(x, y1, y2, where=y2y1, facecolor='green')
ax.fill_between(x, y1, y2, where=y2=y1, facecolor='red')
ax.set_title('fill between where')

It should be calling ax.plot() not ax1.plot()

Incidentally, when you do it with ax.plot() instead you can see more  
easily that the corners where the two sinusoidal functions intersect  
are getting kind of chopped off by the polygon filling.  Don't know if  
there's an easy way to fix that - maybe by forcing the list of polygon  
vertices to always explicitly include the points of intersection  
between the functions being filled_between?  Or maybe just by  
increasing the number of vertices, though I assume that would slow  
things down.


--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Filling between curves conditionally

2008-11-22 Thread Zane Selvans
Does anybody know of an easy way to take two intersecting curves, A(x)  
and B(x), and fill the areas between them only when A(x)  B(x) and  
not when A(x)  B(x)?


--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Multi-histogram example generates errors

2008-11-13 Thread Zane Selvans


On Nov 12, 2008, at 8:12 PM, Eric Firing wrote:
The example code runs with mpl from svn, so I suspect you are  
running into an example that was written to show capabilities added  
since the last release.  In fact, it looks like that 6212 #todo is  
the clue: it is not found in the svn version.


Hmm.  It seems like it might be better to have the default online  
documentation generated from the current release, instead of the  
bleeding edge.  The title of the page does after all say: Matplotlib  
v0.98.3 documentation.  Of course there could be an svn version  
accessible somewhere too, but having this kind of disconnect between  
what people have installed, and what the default doc refers to, will  
probably create other headaches too.


Just my $0.02,
Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Multi-histogram example generates errors

2008-11-12 Thread Zane Selvans
I'm trying to make a bar-style histogram, along the lines of the last  
example figure from the extended histogram demo:


http://matplotlib.sourceforge.net/examples/pylab_examples/histogram_demo_extended.html

in which the several arrays to be histogrammed do not have the same  
length.  However, I'm getting an error about setting an array element  
with a sequence, even when I just cut-and-paste in the example code.   
The previous multi-histogram examples in which the array being plotted  
is generated using: x = mu + sigma*randn(1000,3) work fine though.


Am I doing something stupid?

Here's the trace:

In [25]: n, bins, patches = hist( [x0,x1,x2], 10, histtype='bar')
---
ValueErrorTraceback (most recent call  
last)


/Users/zane/svn/googlecode/ipython console in module()

/Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3- 
i386.egg/matplotlib/pyplot.pyc in hist(*args, **kwargs)

   1866 hold(h)
   1867 try:
- 1868 ret =  gca().hist(*args, **kwargs)
   1869 draw_if_interactive()
   1870 except:

/Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5-macosx-10.3- 
i386.egg/matplotlib/axes.pyc in hist(self, x, bins, range, normed,  
cumulative, bottom, histtype, align, orientation, rwidth, log, **kwargs)

   6211
   6212 # todo: make hist() work with list of arrays with  
different lengths

- 6213 x = np.asarray(x).copy()
   6214 if len(x.shape)==2 and min(x.shape)==1:
   6215 x.shape = max(x.shape),

/Library/Python/2.5/site-packages/numpy-1.2.0.dev5677-py2.5- 
macosx-10.3-i386.egg/numpy/core/numeric.pyc in asarray(a, dtype, order)

228
229 
-- 230 return array(a, dtype, copy=False, order=order)
231
232 def asanyarray(a, dtype=None, order=None):

ValueError: setting an array element with a sequence.


--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ANN: matplotlib website 1.0

2008-10-17 Thread Zane Selvans
First, are there plans to eventually embed autogenerated plots in  
the the examples section (http://matplotlib.sourceforge.net/examples/ 
) http://matplotlib.sourceforge.net/examples/%29 in the same way  
that they're embedded within the user guide?
There are plans to do that, and probably to have a thumbnail  
gallery of examples as well.  The sticking point is that many of  
the examples generate multiple figures, and we currently don't have  
a way to save those out automatically from the documentation.  Just  
need to make that work.


A thumbnail gallery of all the examples in the User's Guide and  
Examples is a great idea!


Plots are inherently visual, and humans have a huge amount of built-in  
visual processing power.  Searching a even an enormous page of images  
to find something that looks like what you're trying to create will be  
much more efficient that trying to come up with the right keyword if  
you don't know what it is already, or scanning a table of contents.


Actually, it reminds me of the graphical abstracts that many  
chemistry journals use - one figure, often showing the molecule(s)  
that the paper is about, which readers can browse online in lieu of  
searching or reading long ISO approved chemical names... which often  
allows almost instant recognition of papers you'll be interested in,  
or at least a serious pruning of the search space.


Second, in the sidebar on the main page, in the Need Help?  
section, I'm seeing a bunch of weird gunk that's probably not  
supposed to be getting through to the web...:


That seems to have been fixed in the meantime.  Still seeing it?


Yep, looks good.

Thanks for all your work!

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F






-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] limiting theta in polar axis plots

2008-10-17 Thread Zane Selvans

Is there any way to limit the theta extent in a polar axis plot?

There are a variety of angular contexts in which 360 degrees are not  
necessary.  To convey the orientation of an undirected line, you need  
only 0-180 degrees.  The minimum separation between two intersecting  
lines only ranges from 0-90 degrees.


It seems like the ideal way for this to work would be to have a  
function analogous to xlim(), maybe called thetalim(thetamin,  
thetamax), and then treat the two bounding radial lines as the primary  
and secondary y axes.


Didn't see anything like this in any of the examples or documentation  
though.  If it's not possible now, I think it would be a wonderful  
addition.


Thanks,
Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F






-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] limiting theta in polar axis plots

2008-10-17 Thread Zane Selvans


On Oct 17, 2008, at 11:06 AM, Michael Droettboom wrote:

No, it's not possible now.  Just so I'm clear -- you're suggesting  
plotting on a wedge from theta_1 to theta_2?  Seems doable with a  
little work.


Yes, exactly.  For instance if I wanted to make a polar bar chart  
showing the distribution of angles separating a collection of lines at  
their intersections, I would only need to display one quarter of the  
polar plot, the first quadrant, from 0-90 degrees.  If I wanted to  
display the orientation of, say, a fault on the surface of the Earth,  
I'd need 180 degrees, but I might want to use the northern half of the  
circle (orientations ranging from West to East (-90, 90)) or perhaps  
the eastern half (ranging from (0, 180)).


Ideally, the user would be able to specify both thetamin and thetamax,  
and also an offset describing the location of theta=0, because in some  
applications it doesn't make sense for zero to be in its traditional  
polar-coordinates location at the right hand side.  E.g. in a  
geographic context, where the angles being displayed are compass  
headings, it is traditional to put zero (north) at the top.  Putting  
zero at the top would also make sense if you were plotting data that  
corresponded to angular deviations to the left and right from some  
specified path.


Some portion of this functionality has been implemented in the  
windrose module, see:


http://youarealegend.blogspot.com/2008/09/windrose.html
http://www.nabble.com/windrose-OO-td16298025.html

but with a mind toward a particular kind of application (windrose  
diagrams obviously :).  But I think allowing users to specify  
(thetamin, thetamax, offset) would be a very generally applicable  
improvement.


Thanks again,
Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F






-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ANN: matplotlib website 1.0

2008-10-16 Thread Zane Selvans

Wow!  The new site looks beautiful.  Thank you!

The apparent lack of searchable, online, well organized, cross- 
referenced documentation has been my main frustration with  
Matplotlib.  I'm very glad it's being worked on.


A couple of quick things:

First, are there plans to eventually embed autogenerated plots in the  
the examples section (http://matplotlib.sourceforge.net/examples/)  
in the same way that they're embedded within the user guide?


Second, in the sidebar on the main page, in the Need Help? section,  
I'm seeing a bunch of weird gunk that's probably not supposed to be  
getting through to the web...:


 .mine  .mine

Check the docs, the faq, and join the matplotlib mailing lists. There  
is a also community wiki cookbook

===

Check the user guide, the

Check the user guide, the  .r6222 href=faq/index.htmlfaq, the  
api docs, archives, and join the matplotlib mailing lists  .r6221


You can file bugs, patches and feature requests on the sourceforge  
tracker, but it is a good idea to ping us on the mailing list too.




--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F






-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Figures missing from matplotlib documentation?

2008-10-13 Thread Zane Selvans


On Oct 9, 2008, at 12:55 PM, John Hunter wrote:

On Thu, Oct 9, 2008 at 2:40 PM, Zane Selvans [EMAIL PROTECTED]  
wrote:



I too often feel like I'm just hacking my way
around in Matplotlib, without understanding how it is actually
supposed to be used (i.e. how it was designed to work).  Is there  
an
architectural overview floating around somewhere that I'm not aware  
of?


Check out http://matplotlib.sourceforge.net/doc/html/users/ 
artists.html


That's just what I was looking for.

However, unfortunately there appears to be some problem with the  
generation of the figures which are supposed to be embedded within  
that documentation - they're all appearing as nothing but blank white  
spaces, both in Firefox 3.0.3 on OS X 10.5.5, and when I download the  
files and view them with other programs.  Do other people see this  
problem?


Thanks again,
Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F






-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How do I make a legend for Line2D ob jects in Basemap, colored using a colormap?

2008-10-09 Thread Zane Selvans
Zane Selvans [EMAIL PROTECTED] writes:

 
 I'm plotting a bunch of lines on a map.  They're being colored  
 according to the value of an attribute associated with the objects  
 they represent, using a colormap.  However, I also need to create a  
 colorbar to act as a legend, describing what the colors of the lines  
 means, in terms of values associated with that attribute.
 
 What's the easiest way to do that?

I've found the matplotlib.colorbar.ColorbarBase class... and have been able to
use matplotlib.colorbar.make_axes() to create a somewhat acceptable set of axes
into which I can put a colorbar constructed from the same colormap that I'm
using to color the lines I'm plotting.  However, I can't seem to get the tics
and axes on the colorbar to correspond to the values associated with the colors
- they only ever go from 0-1.  I want them to go from, for instance, 0-180
(degrees) in 20 or 30 degree intervals.  It seemed like setting the keyword
arguments in ColorbarBase(boundaries=[0,180]) or values=linspace(0,180,10) or
something like that ought to have done the right thing... but no, and I don't
see any documentation on how these keywords are supposed to be used, in the
docstring or elsewhere... anyone know how they work?





-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How do I make a legend for Line2D objects in Basemap, colored using a colormap?

2008-10-09 Thread Zane Selvans

On Oct 9, 2008, at 7:08 AM, Ryan May wrote:

 Zane Selvans wrote:
 Zane Selvans [EMAIL PROTECTED] writes:

 I also need to create a
 colorbar to act as a legend, describing what the colors of the lines
 means, in terms of values associated with that attribute.

 I've found the matplotlib.colorbar.ColorbarBase class...
 I want them to go from, for instance, 0-180
 (degrees) in 20 or 30 degree intervals.  It seemed like setting the  
 keyword
 arguments in ColorbarBase(boundaries=[0,180]) or  
 values=linspace(0,180,10) or
 something like that ought to have done the right thing... but no,  
 and I don't
 see any documentation on how these keywords are supposed to be  
 used, in the
 docstring or elsewhere... anyone know how they work?

 You need to pass an instance of a matplotlib.colors.Normalize to the
 constructure to ColorbarBase, as in:

 cbar = ColorbarBase(norm=Normalize(0, 180))

Ahhh.  There we go.

 As far as colormapping lines, you can do this using a LineCollection  
 object.

Hmm.  I'll have a look at these.  Jeff Whitaker suggested them for  
something else too. I too often feel like I'm just hacking my way  
around in Matplotlib, without understanding how it is actually  
supposed to be used (i.e. how it was designed to work).  Is there an  
architectural overview floating around somewhere that I'm not aware of?

Thanks for the help!
Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F







-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How do I make a legend for Line2D objects in Basemap, colored using a colormap?

2008-10-08 Thread Zane Selvans
I'm plotting a bunch of lines on a map.  They're being colored  
according to the value of an attribute associated with the objects  
they represent, using a colormap.  However, I also need to create a  
colorbar to act as a legend, describing what the colors of the lines  
means, in terms of values associated with that attribute.

What's the easiest way to do that?

I know what the upper and lower bounds of the values that need to be  
represented in the colorbar are, but I don't see any way to just slap  
a generic colorbar on the figure and give it some tick marks  
corresponding to the values I know the colors represent.

I have a list of all the Line2D objects in the map, but I can't pass  
them to colorbar() as the 'mappable' parameter without getting:

AttributeError: 'Line2D' object has no attribute 'autoscale_None'

It seems like this is something that should be trivially easy, but I  
don't see how to do it in the documentation anywhere.

Thanks for any insight you might have...

Zane

--
Zane Selvans
Amateur Earthling
[EMAIL PROTECTED]
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F







-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Slow drawing of many lines in Basemap

2008-08-25 Thread Zane Selvans

On Aug 22, 2008, at 5:08 AM, Jeff Whitaker wrote:

 Zane Selvans wrote:
 I'm drawing several hundred lines at a time, each consisting of  
 10-100  points, and it takes a couple of minutes for them all to  
 display,  which makes me think I must be doing something stupid.

 Zane:  You can set up a LineCollection like this

 lcoll = LineCollection(segments)

 then add it to the current axes

 ax = pylab.gca()
 ax.add_collection(lcoll)

 (instead of using the Basemap plot method).

It turned out that just adding:

interactive(False)

before the drawing loop, and

show()

after it, sped things up tremendously.  Instead of 5 minutes, it now  
takes about 2 seconds for the map to render.  Which, ironically, is  
much more interactive :)

Thanks for the pointer to LineCollection though.  I'd never seen that.

Zane

--
Zane Selvans
Amateur Earthling
http://zaneselvans.org
[EMAIL PROTECTED]
303/815-6866
PGP Key: 55E0815F


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Slow drawing of many lines in Basemap

2008-08-20 Thread Zane Selvans
I'm drawing several hundred lines at a time, each consisting of 10-100  
points, and it takes a couple of minutes for them all to display,  
which makes me think I must be doing something stupid.

The function that does the drawing looks like this:

def plotlinmap(lins, map=None):
 if map is None:
 map = Basemap()

 map.drawmapboundary(fill_color=white)
 map.drawmeridians(range(-180,181,30)), labels=[1,0,0,1])
 map.drawparallels(range(-90,91,30)), labels=[1,0,0,1])

 for lin in lins:
 x,y = map(degrees(lin.longitudes()),degrees(lin.latitudes()))
 map.plot(x,y)

 return(map)

It displays one line at a time, whenever map.plot() is called.  Really  
I'd like it to just do all the drawing at the end (assuming that would  
make the whole process much faster).  Is there some way to cleanly  
pass map.plot() a big list of lines to draw?  I'm sure there is and  
I'm just being dense.  Argh.

--
Zane Selvans
Amateur Earthling
http://zaneselvans.org
[EMAIL PROTECTED]
303/815-6866
PGP Key: 55E0815F


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Using OGR/GDAL objects with Basemap

2008-08-06 Thread Zane Selvans
Has anyone here ever used Basemap to display datasets/layers/features  
created using the OGR/GDAL libraries (http://www.gdal.org/)?  They're  
SWIG wrappers, not pure Python, so I could see integration maybe being  
a pain.  Just curious if there was anything out there to build on  
already...

Thanks!

--
Zane Selvans
Amateur Earthling
http://zaneselvans.org
[EMAIL PROTECTED]
303/815-6866
PGP Key: 55E0815F


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Using OGR/GDAL objects with Basemap

2008-08-06 Thread Zane Selvans
Oh, great!  I'm a dunce.  I should really go through and put all the  
Basemap examples into the Matplotlib cookbook so they come up when I  
search for them on the web.  Er, when somebody else searches for them  
on the web... since I'd be familiar with all of them if I put them up!

Is there some reason that many of the example files haven't been  
updated to import basemap from the new mpl_toolkits.basemap instead of  
the old matplotlib.toolkits.basemap?  Or maybe my version of the  
examples (0.99) isn't the most recent?

Zane

On Aug 6, 2008, at 2:15 PM, Jeff Whitaker wrote:

 Zane Selvans wrote:
 Has anyone here ever used Basemap to display datasets/layers/ 
 features  created using the OGR/GDAL libraries (http://www.gdal.org/)? 
   They're  SWIG wrappers, not pure Python, so I could see  
 integration maybe being  a pain.  Just curious if there was  
 anything out there to build on  already...

 Thanks!

 --
 Zane Selvans
 Amateur Earthling
 http://zaneselvans.org
 [EMAIL PROTECTED]
 303/815-6866
 PGP Key: 55E0815F



 Zane:  You can use Basemap to plot GIS data you've read in with ogr/ 
 gdal.  There's an example included with basemap (testgdal.py).  I'm  
 not a  gdal user, so I may be missing something - what sort of  
 integration do you have in mind?

 -Jeff

 -- 
 Jeffrey S. Whitaker Phone  : (303)497-6313
 Meteorologist   FAX: (303)497-6449
 NOAA/OAR/PSD  R/PSD1Email  : [EMAIL PROTECTED]
 325 BroadwayOffice : Skaggs Research Cntr 1D-113
 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg


--
Zane Selvans
Amateur Earthling
http://zaneselvans.org
[EMAIL PROTECTED]
303/815-6866
PGP Key: 55E0815F


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] least squares fitting of great circle to points on a sphere

2008-08-04 Thread Zane Selvans
Does anyone out there happen to know a simple algorithm for least  
squares fitting a great circle to a given set of lat/lon points on a  
sphere?  Seems like it might not be a crazy thing to add to the library.

Thanks!
Zane

--
Zane Selvans
Amateur Earthling
http://zaneselvans.org
[EMAIL PROTECTED]
303/815-6866
PGP Key: 55E0815F


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] cyclic longitude in Basemap

2008-08-01 Thread Zane Selvans
Hi all,

Does anybody know how one gets a mpl_toolkits.basemap.Basemap map to  
automatically recognize when a feature has run off the end of the  
longitude range, and needs to wrap around and show up on the far side  
of a map having global extent?  I have a bunch of linear features I'm  
trying to plot intelligently... and what happens now is, either the  
feature runs off the edge, and disappears, or, if I change the  
coordinates making up the object to all lie within the longitude range  
that the map contains, then I end up with a line going all the way  
across the map from one side to the other, connecting the two portions  
of the feature.

There's this function addcyclic, but I don't think it does what I  
want.  Actually, I'm not exactly clear on what it does.

Thanks for any insight you might have,

Zane

--
Zane Selvans
Amateur Earthling
http://zaneselvans.org
[EMAIL PROTECTED]
303/815-6866
PGP Key: 55E0815F


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] from pylab import nx?

2008-03-18 Thread Zane Selvans

Chris Withers wrote:

Hi All,

A few of the units demos include the lines:

from pylab import nx

...but this import errors for me.


Not sure if this is relevant, but NX is a frequently used shorthand for 
the NetworkX graph/network analysis package from Los Alamos National Labs:


https://networkx.lanl.gov/reference/networkx/networkx-module.html

i.e. people do:

import NetworkX as nx

It has a sub-package for drawing networks in pylab 
(networkx.drawing.nx_pylab).  Maybe at some point someone was trying to 
integrate NetworkX with pylab directly and some tests got left laying 
around?  The NetworkX guys would probably know.


--
Zane Selvans
Amateur Human
[EMAIL PROTECTED]
303/815-6866
PGP Key: 55E0815F
begin:vcard
fn:Zane Selvans
n:Selvans;Zane
org:Earthlings
adr:;;200 S. Parkwood Ave.;Pasadena;CA;91107;USA
email;internet:[EMAIL PROTECTED]
title:Amateur Human
tel;cell:(303) 815-6866
x-mozilla-html:TRUE
url:https://ideotrope.org
version:2.1
end:vcard

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Analyzing unprojected (spherical, geodetic) vector data and Matplotlib

2008-03-14 Thread Zane Selvans

Hello all,

I need to do analysis of vector data (linear features, polylines) on the 
surface of a sphere.  Many of the lines span a significant portion of 
the circumferance of the the body in question (Jupiter's moon Europa), 
and I want to be able to do the display of the data and analysis within 
Matplotlib.


Rather than writing my own (probably lame) module for manipulating and 
generating linear features stored as lists of (lat,lon) points, I'd 
prefer to build on someone else's work.


After a little searching around, it seems like most open GIS packages 
(e.g. OGL, GDAL) seem to work exclusively within a projected planar 
space.  Am I missing something?  Is there anyone else out there that 
does this kind of thing?  What solutions do people have that work well 
with Matplotlib and the Basemap toolkit?


Ideally, I'd like to have the ability to perform transformations on the 
polylines, rotating and translating them on the surface of the sphere 
(without having to do the spherical trig myself), and I have to be able 
to have features cross the date line and wrap-around intelligently, 
calculate great-circle distances (and forward/back azimuths), best-fit 
great circles, etc.


Thanks for any recommendations you might have,
Zane

--
Zane Selvans
Amateur Human
[EMAIL PROTECTED]
303/815-6866
PGP Key: 55E0815F
begin:vcard
fn:Zane Selvans
n:Selvans;Zane
org:Earthlings
adr:;;200 S. Parkwood Ave.;Pasadena;CA;91107;USA
email;internet:[EMAIL PROTECTED]
title:Amateur Human
tel;cell:(303) 815-6866
x-mozilla-html:TRUE
url:https://ideotrope.org
version:2.1
end:vcard

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] NetCDF input/output/plotting using Matplotlib w/ Basemap

2008-03-08 Thread Zane Selvans
I have a model that calculates the tidal stress tensor (a symmetric 2x2 
matrix) on the surface of an icy satellite.  It's just two orthogonal 
vector fields on the surface of the body.  I want to be able to make 
pretty plots of the model output, including:


* The magnitude of either one of the fields at any point
* The magnitude and orientation of either or both fields, as a grid of 
little arrows, whose colors correspond to whether the value is positive 
or negative.

* Animations of time (or other) series.

I also want to be able to save the model output in a format that other 
people can read and manipulate.  Ideally, model run results could also 
be hosted on a web server, and other people could view them remotely.


I just re-wrote the model in pure Python (it had been written in C 
previously), and I've been using my own hacked together ASCII file 
format and a Perl script that builds GMT plots based on them to make 
figures and visualizations up until now... but I'm sick of that and want 
something more flexible.


This all seems to suggest to me, after a little poking around, that the 
NetCDF file format would be good.  I've managed to get SciPy and 
Matplotlib and Basemap installed and apparently working together 
happily... but I can't seem to find any official module within that 
structure for writing NetCDF files.  There are references to the old 
Scientific.IO.NetCDF package, and I found something that had been 
hanging around in the scipy.sandbox area... but which isn't there any 
more.  There's quite a list of Python interfaces to NetCDF on the 
Unidata website... but they don't make any recommendations as to which 
is best.


If I'm going to be working within Matplotlib and Basemap and SciPy, does 
anyone have a good recommendation for which NetCDF Python package to 
use?  Or issues I should consider?


Thanks for any insight,

Zane

--
Zane Selvans
Amateur Human
[EMAIL PROTECTED]
303/815-6866
PGP Key: 55E0815F
begin:vcard
fn:Zane Selvans
n:Selvans;Zane
org:Earthlings
adr:;;200 S. Parkwood Ave.;Pasadena;CA;91107;USA
email;internet:[EMAIL PROTECTED]
title:Amateur Human
tel;cell:(303) 815-6866
x-mozilla-html:TRUE
url:https://ideotrope.org
version:2.1
end:vcard

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users