Re: [Matplotlib-users] Basemap continent colors

2010-05-12 Thread Michael Hearne
Jeff - That's great, thanks!  For future releases, is there a reason why 
fillcontinents() couldn't do the logic for the user - i.e., if the continent 
fills the figure, paint it with the user's desired color?  I think that's less 
surprising than the way it works now.

--Mike


On May 11, 2010, at 2:22 PM, Jeff Whitaker wrote:

 On 5/11/10 8:02 AM, Michael Hearne wrote:
 Jeff - Thanks.  Is there an easy way you know of to detect when there are no 
 continent boundaries?  I'm making these maps automatically, and so will not 
 have the luxury of examining them to see where they are.
 
 --Mike
   
 
 Mike:  Unfortunately, there is no easy way to check since those computations 
 are only done when you call fillcontinents.  Here's a function that follows 
 the logic in fillcontinents:
 
 def all_land(map):
for poly,type in zip(map.coastpolygons, map.coastpolygontypes):
if type == 1:
x, y = poly
xa = np.array(x,np.float32)
ya = np.array(y,np.float32)
# check to see if all four corners of domain in polygon (if so,
# don't draw since it will just fill in the whole map).
delx = 10; dely = 10
if map.projection in ['cyl']:
delx = 0.1
dely = 0.1
test1 = np.fabs(xa-map.urcrnrx)  delx
test2 = np.fabs(xa-map.llcrnrx)  delx
test3 = np.fabs(ya-map.urcrnry)  dely
test4 = np.fabs(ya-map.llcrnry)  dely
hasp1 = np.sum(test1*test3)
hasp2 = np.sum(test2*test3)
hasp4 = np.sum(test2*test4)
hasp3 = np.sum(test1*test4)
if not hasp1 or not hasp2 or not hasp3 or not hasp4:
allin = False
else:
allin = True
return allin
 
 If you pass this function the basemap instance, it should return True if no 
 coastline polygons will be drawn.
 
 -Jeff
 
 On May 10, 2010, at 2:57 PM, Jeff Whitaker wrote:
 
   
 On 5/10/10 2:21 PM, Michael Hearne wrote:
 
 I have found  a (possible) bug in Basemap - when using 
 basemap.fillcontinents(), I see the chosen continent color only when the 
 map I create includes some ocean.  If I am in the interior of a continent 
 (I've tested with North America and Asia), the continent color is white.
 
   
 Michael:  If there are no continent boundaries inside the map projection 
 region, basemap does not draw anything (hence you see the axis background 
 color).  In that case, you should just set the axis background color to 
 whatever you wanted  the continent color to be.
 
 -Jeff
 
 A code sample is below.  My version information:
 Basemap: 0.99.4
 Matplotlib: 0.99.1.1
 numpy: 1.4.0
 Python: 2.6.4
 
 To replicate my results, please try the following:
 ./maptest.py 37.894507 -121.816406  #map center is somewhere in the Bay 
 Area in California
 ./maptest.py 41.880332 -100.47821  #map center is somewhere in Nebraska
 
 The script creates a file called output.png in the calling directory.  
 In the California case, I see the ocean as blue, and the land as a sort of 
 annoying salmon color.  In the Nebraska case, I see white with blue 
 denoting the various rivers and lakes in the area.
 
 Am I mis-using the basemap method calls in some way?
 
 Thanks,
 
 Mike
 
 
 #!/usr/bin/env python
 
 import matplotlib
 #use the non-interactive matplotlib setting
 matplotlib.use('agg')
 from mpl_toolkits.basemap import Basemap
 import numpy as np
 from pylab import *
 import sys
 
 clat = float(sys.argv[1])
 clon = float(sys.argv[2])
 
 figwidth = 5.4
 
 
 bounds = (clon-4, clon+4, clat-4, clat+4)
 dx = (bounds[1] - bounds[0])*91 * np.cos(clat * np.pi/180)
 dy = (bounds[3] - bounds[2])*91
 aspect = dy/dx
 figheight = aspect * figwidth
 
 fig = figure(figsize=(figwidth,figheight),edgecolor='g',facecolor='g')
 ax1 = fig.add_axes([0,0,1.0,1.0])
 mapcontour = Basemap(llcrnrlon=bounds[0],llcrnrlat=bounds[2],
  urcrnrlon=bounds[1],urcrnrlat=bounds[3],
  resolution='h',projection='merc',lat_ts=clat)
 water_color = [.47,.60,.81]
 mapcontour.drawrivers(color=water_color)
 mapcontour.drawcountries(color='k',linewidth=2.0)
 mapcontour.drawcoastlines()
 mapcontour.fillcontinents(color=[1.0,0.8,0.8],lake_color=water_color)
 
 plt.savefig('output.png')
 
 
 
 --
 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
   
 
   
 
 
 -- 
 Jeffrey S. Whitaker Phone  : (303)497-6313
 Meteorologist   FAX: (303)497-6449
 NOAA/OAR/PSD  R/PSD1Email  : jeffrey.s.whita...@noaa.gov
 325 BroadwayOffice : Skaggs

Re: [Matplotlib-users] Basemap continent colors

2010-05-11 Thread Michael Hearne
Jeff - Thanks.  Is there an easy way you know of to detect when there are no 
continent boundaries?  I'm making these maps automatically, and so will not 
have the luxury of examining them to see where they are.

--Mike 
On May 10, 2010, at 2:57 PM, Jeff Whitaker wrote:

 On 5/10/10 2:21 PM, Michael Hearne wrote:
 I have found  a (possible) bug in Basemap - when using 
 basemap.fillcontinents(), I see the chosen continent color only when the map 
 I create includes some ocean.  If I am in the interior of a continent (I've 
 tested with North America and Asia), the continent color is white.
   
 
 Michael:  If there are no continent boundaries inside the map projection 
 region, basemap does not draw anything (hence you see the axis background 
 color).  In that case, you should just set the axis background color to 
 whatever you wanted  the continent color to be.
 
 -Jeff
 A code sample is below.  My version information:
 Basemap: 0.99.4
 Matplotlib: 0.99.1.1
 numpy: 1.4.0
 Python: 2.6.4
 
 To replicate my results, please try the following:
 ./maptest.py 37.894507 -121.816406  #map center is somewhere in the Bay Area 
 in California
 ./maptest.py 41.880332 -100.47821  #map center is somewhere in Nebraska
 
 The script creates a file called output.png in the calling directory.  In 
 the California case, I see the ocean as blue, and the land as a sort of 
 annoying salmon color.  In the Nebraska case, I see white with blue denoting 
 the various rivers and lakes in the area.
 
 Am I mis-using the basemap method calls in some way?
 
 Thanks,
 
 Mike
 
 
 #!/usr/bin/env python
 
 import matplotlib
 #use the non-interactive matplotlib setting
 matplotlib.use('agg')
 from mpl_toolkits.basemap import Basemap
 import numpy as np
 from pylab import *
 import sys
 
 clat = float(sys.argv[1])
 clon = float(sys.argv[2])
 
 figwidth = 5.4
 
 
 bounds = (clon-4, clon+4, clat-4, clat+4)
 dx = (bounds[1] - bounds[0])*91 * np.cos(clat * np.pi/180)
 dy = (bounds[3] - bounds[2])*91
 aspect = dy/dx
 figheight = aspect * figwidth
 
 fig = figure(figsize=(figwidth,figheight),edgecolor='g',facecolor='g')
 ax1 = fig.add_axes([0,0,1.0,1.0])
 mapcontour = Basemap(llcrnrlon=bounds[0],llcrnrlat=bounds[2],
  urcrnrlon=bounds[1],urcrnrlat=bounds[3],
  resolution='h',projection='merc',lat_ts=clat)
 water_color = [.47,.60,.81]
 mapcontour.drawrivers(color=water_color)
 mapcontour.drawcountries(color='k',linewidth=2.0)
 mapcontour.drawcoastlines()
 mapcontour.fillcontinents(color=[1.0,0.8,0.8],lake_color=water_color)
 
 plt.savefig('output.png')
 
 
 
 --
 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   
 


--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Basemap continent colors

2010-05-10 Thread Michael Hearne
I have found  a (possible) bug in Basemap - when using 
basemap.fillcontinents(), I see the chosen continent color only when the map I 
create includes some ocean.  If I am in the interior of a continent (I've 
tested with North America and Asia), the continent color is white.

A code sample is below.  My version information:
Basemap: 0.99.4
Matplotlib: 0.99.1.1
numpy: 1.4.0
Python: 2.6.4

To replicate my results, please try the following:
./maptest.py 37.894507 -121.816406  #map center is somewhere in the Bay Area in 
California
./maptest.py 41.880332 -100.47821  #map center is somewhere in Nebraska

The script creates a file called output.png in the calling directory.  In the 
California case, I see the ocean as blue, and the land as a sort of annoying 
salmon color.  In the Nebraska case, I see white with blue denoting the various 
rivers and lakes in the area.

Am I mis-using the basemap method calls in some way?

Thanks,

Mike


#!/usr/bin/env python

import matplotlib
#use the non-interactive matplotlib setting
matplotlib.use('agg')
from mpl_toolkits.basemap import Basemap
import numpy as np
from pylab import *
import sys

clat = float(sys.argv[1])
clon = float(sys.argv[2])

figwidth = 5.4


bounds = (clon-4, clon+4, clat-4, clat+4)
dx = (bounds[1] - bounds[0])*91 * np.cos(clat * np.pi/180)
dy = (bounds[3] - bounds[2])*91
aspect = dy/dx
figheight = aspect * figwidth
  
fig = figure(figsize=(figwidth,figheight),edgecolor='g',facecolor='g')
ax1 = fig.add_axes([0,0,1.0,1.0])
mapcontour = Basemap(llcrnrlon=bounds[0],llcrnrlat=bounds[2],
 urcrnrlon=bounds[1],urcrnrlat=bounds[3],
 resolution='h',projection='merc',lat_ts=clat)
water_color = [.47,.60,.81]
mapcontour.drawrivers(color=water_color)
mapcontour.drawcountries(color='k',linewidth=2.0)
mapcontour.drawcoastlines()
mapcontour.fillcontinents(color=[1.0,0.8,0.8],lake_color=water_color)

plt.savefig('output.png') 



--

___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] imshow smoothing

2009-09-22 Thread Michael Hearne
Great!

Thanks,

Mike
On Sep 22, 2009, at 2:38 PM, Gary Ruben wrote:

 Yes. Use interpolation='nearest' instead.

 Gary R.

 Michael Hearne wrote:
 Running the test script below gives me the image I have attached,  
 which looks like it has been smoothed.
 Does imshow perform some sort of smoothing on the data it  
 displays?  If so, is there a way to turn this off?
 #!/usr/bin/env python
 from pylab import *
 data = array([[1,2,3,4],[5,6,7,8]])
 imshow(data,interpolation=None)
 savefig('output.png')
 close('all')


--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Building matplotlib on os x

2009-08-11 Thread Michael Hearne
Hello - I am attempting to build matplotlib from source on os X, and  
getting an error about a shared library being the wrong architecture.   
The confusing thing is that the call to g++ has two settings for arch:

g++ -arch i386 -arch ppc...

The error I get is:
ld: in /Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks/ 
Python.framework/Versions/4.3.0/lib/libz.1.dylib, file is not of  
required architecture for architecture ppc

Is there some way to turn off the -arch ppc option to g++ in  
setup.py?  Or do I have some other problem?

Build output is included below.

Thanks,

Mike

= 
= 
= 
= 

BUILDING MATPLOTLIB
 matplotlib: 0.99.0
 python: 2.5.4 |EPD_Py25 4.3.0| (r254:67916, May 17  
2009,
 20:07:12)  [GCC 4.0.1 (Apple Computer, Inc.  
build
 5370)]
   platform: darwin

REQUIRED DEPENDENCIES
  numpy: 1.3.0
  freetype2: 9.20.3

OPTIONAL BACKEND DEPENDENCIES
 libpng: 1.2.37
Tkinter: Tkinter: 67737, Tk: 8.4, Tcl: 8.4
   wxPython: 2.8.7.1
 * WxAgg extension not required for wxPython  
 = 2.8
   Gtk+: no
 * Building for Gtk+ requires pygtk; you must  
be able
 * to import gtk in your build/install  
environment
Mac OS X native: yes
 Qt: no
Qt4: no
  Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
   datetime: present, version unknown
   dateutil: 1.4
   pytz: 2008c

OPTIONAL USETEX DEPENDENCIES
 dvipng: no
ghostscript: 8.54
  latex: no

[Edit setup.cfg to suppress the above messages]
= 
= 
= 
= 

pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends',  
'matplotlib.projections', 'mpl_toolkits', 'mpl_toolkits.mplot3d',  
'mpl_toolkits.axes_grid', 'matplotlib.sphinxext',  
'matplotlib.numerix', 'matplotlib.numerix.mlab',  
'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra',  
'matplotlib.numerix.random_array', 'matplotlib.numerix.fft',  
'matplotlib.delaunay']
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc - build/lib.macosx-10.3- 
fat-2.5/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf - build/ 
lib.macosx-10.3-fat-2.5/matplotlib/mpl-data
running build_ext
building 'matplotlib.backends._tkagg' extension
creating build/temp.macosx-10.3-fat-2.5
creating build/temp.macosx-10.3-fat-2.5/src
creating build/temp.macosx-10.3-fat-2.5/CXX
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk - 
fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd - 
fno-common -dynamic -DNDEBUG -g -O3 -I/tmp/_py/libraries/usr/local/ 
include -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -I/System/Library/ 
Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/ 
Tcl.framework/Versions/Current/PrivateHeaders -I/System/Library/ 
Frameworks/Tk.framework/Headers -I/System/Library/Frameworks/ 
Tk.framework/Versions/Current/PrivateHeaders -I/usr/local/include -I/ 
usr/include -I/sw/include -I. -I/Library/Frameworks/Python.framework/ 
Versions/4.3.0/lib/python2.5/site-packages/numpy-1.3.0n1-py2.5- 
macosx-10.3-fat.egg/numpy/core/include -Isrc -Iagg24/include -I. -I/ 
Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site- 
packages/numpy-1.3.0n1-py2.5-macosx-10.3-fat.egg/numpy/core/include -I/ 
opt/local/include/freetype2 -I/opt/local/include -I/usr/local/include - 
I/usr/include -I/sw/include -I. -I/Library/Frameworks/Python.framework/ 
Versions/4.3.0/include/python2.5 -c src/agg_py_transforms.cpp -o build/ 
temp.macosx-10.3-fat-2.5/src/agg_py_transforms.o -framework Tcl - 
framework Tk
powerpc-apple-darwin9-gcc-4.0.1: -framework: linker input file unused  
because linking not done
powerpc-apple-darwin9-gcc-4.0.1: Tcl: linker input file unused because  
linking not done
powerpc-apple-darwin9-gcc-4.0.1: -framework: linker input file unused  
because linking not done
powerpc-apple-darwin9-gcc-4.0.1: Tk: linker input file unused because  
linking not done
i686-apple-darwin9-gcc-4.0.1: -framework: linker input file unused  
because linking not done
i686-apple-darwin9-gcc-4.0.1: Tcl: linker input file unused because  
linking not done
i686-apple-darwin9-gcc-4.0.1: -framework: linker input file unused  
because linking not done
i686-apple-darwin9-gcc-4.0.1: Tk: linker input file unused because  
linking not done
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk - 
fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd - 
fno-common -dynamic -DNDEBUG -g -O3 -I/tmp/_py/libraries/usr/local/ 
include -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -I/System/Library/ 

[Matplotlib-users] bug in PDFs

2009-06-12 Thread Michael Hearne
All: I am using PDF files generated from matplotlib, and a PDF parser  
from ReportLab, Inc.  Their tool encountered a bug in the PDF  
specification.  The company's email to me follows:




...matplotlib is violating the PDF specification.   There
is a structure near the end of the file shown below, and they have put
an 'n' instead of an 'f' which tells a (suitably pedantic) parser that
the first meaningful content is to be found at byte 0 in the file, not
byte 16 where it really lives.

xref
0 62
00 65535 n    should be 'f'
16 0 n
65 0 n
000218 0 n

That row with the ' 65535' is present in all PDF files.  I
change the 'n' to an 'f' in a good binary editor and it goes through
fine.

I have also added a special case to our code to correct for this. I
suspect other PDF viewers just skip the first row so were not bitten.


I was able to figure out which module contains the offending code, but  
not which lines actually print out that data.


I submitted a bug report here:
https://sourceforge.net/tracker/?func=detailaid=2805455group_id=80706atid=560720

Thanks,

Mike



--
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] drawing un-filled text with matplotlib

2009-06-11 Thread Michael Hearne
I apologize if I am using the wrong terminology for this, but I am  
trying to reproduce the un-filled text effect in the attached image  
with matplotlib.  Is this possible?


Thanks,

Mike

inline: text.png

--
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] compound conditions with pylab.find

2009-04-01 Thread Michael Hearne
Is it possible to use multiple conditionals with the pylab.find() function?

For example, in Matlab, I can do the following:

x = rand(1,10);
i = find(x  0.5  x  0.9); %returns the indices between 0.5 and 0.9

In Python: (ipython -pylab)
x = rand(1,10)

None of the following approaches work:
#i = find(x  0.5 and x  0.9)
#i = find(x  0.5  x  0.9)
#i = find(x  0.5  x  0.9)

I'm pretty certain there is some other way to do this using a numpy 
method, and if that's all there is, then I will happily use it.

However, if the goal of the pylab module is to achieve (some level of) 
compatibility with Matlab, then may I suggest this sort of functionality 
be added to the pylab.find() function?

Thanks,

Mike


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap data installation

2009-03-30 Thread Michael Hearne
Jeff - Copying the rest of the files solved the problem.  Thanks!

--Mike
Jeff Whitaker wrote:
 Michael Hearne wrote:
 I am experimenting with the Enthought Python Distribution (EPD) on 
 MacOS 10.5, which includes BaseMap version 0.99.1.  I have existing 
 modules that use the 'full' resolution data.  These modules are 
 currently failing with the error message below.

 I have tried copying what looked like the full resolution data sets 
 (gshhs_f.dat and gshhsmeta_f.dat) from my 0.99.2 source installation 
 into the EPD basemap data directory, and rerun my scripts, with no 
 success.

 I looked at my most recent copy of the basemap README and cannot find 
 any reference to the boundary datasets.

 So, a question for Jeff, and a request for Enthought:
 1) How do I update the EPD with the full resolution data
 2) Can the EPD be updated to include the full resolution boundary data?

 Thanks,

 Mike

 ***
 IOError: Unable to open boundary dataset file. Only the 'crude', 'low',
 'intermediate' and 'high' resolution datasets are installed by default.
 If you are requesting a 'full' resolution dataset, you may need to
 download and install those files separately
 (see the basemap README for details).
 Exception caught: Unable to open boundary dataset file. Only the 
 'crude', 'low',
 'intermediate' and 'high' resolution datasets are installed by default.
 If you are requesting a 'full' resolution dataset, you may need to
 download and install those files separately
 (see the basemap README for details).
 ***

 --
  

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   
 Mike:  To save space, the EPD folks took out the full resolution 
 datasets.  Manually copying the files should work - are you sure you 
 got them in the right place (the mpl_toolkits/basemap/data 
 directory)?  You probably have to copy more than the gshhs file (the 
 states, rivers and countries too).

 -Jeff



--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] installing matplotlib

2009-03-20 Thread Michael Hearne
Two questions:
1) I'm trying to upgrade an installation of matplotlib I have on a RHEL5 
system.  When trying:

/usr/local/bin/python setup.py build

I get the error message:
gcc: src/ft2font.cpp: C++ compiler not installed on this system
error: command 'gcc' failed with exit status 1

I do in fact have a C++ compiler on the system, in the form of g++.  Is 
there a place where I can configure the C++ compiler to use?

2)  So that I don't have to bother the list with things like this, how 
can I _search_ the mailing list for keywords?  If I go here:

http://sourceforge.net/mailarchive/forum.php?forum_name=matplotlib-users

I don't see any way to search the archives, other than manually paging 
through them.

 

--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] installing matplotlib

2009-03-20 Thread Michael Hearne
I can't using gcc, but I can using g++, which is installed.  I guess 
I'll just set the CXX variable to the path for g++.

I don't know enough about gcc to understand why the two aren't linked 
together...

Thanks for the help,

Mike
Michael Droettboom wrote:
 Michael Hearne wrote:
 Two questions:
 1) I'm trying to upgrade an installation of matplotlib I have on a 
 RHEL5 system.  When trying:

 /usr/local/bin/python setup.py build

 I get the error message:
 gcc: src/ft2font.cpp: C++ compiler not installed on this system
 error: command 'gcc' failed with exit status 1

 I do in fact have a C++ compiler on the system, in the form of g++.  
 Is there a place where I can configure the C++ compiler to use?
   
 distutils will use the CXX environment variable if it is set.  Though 
 you should be able to compile C++ with gcc as well, if the C++ backend 
 is installed -- that's why the error message is surprising to me if 
 you're certain you have g++ installed.  Can you compile a simple C++ 
 file with gcc directly from the commandline?

 Cheers,
 Mike



--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] installing matplotlib

2009-03-20 Thread Michael Hearne
I tried setting CXX=/usr/bin/g++ in my .bashrc, but I still get the same 
error.  Is there some file in the matplotlib distribution that I need to 
edit with this information?

--Mike

Michael Hearne wrote:
 I can't using gcc, but I can using g++, which is installed.  I guess 
 I'll just set the CXX variable to the path for g++.

 I don't know enough about gcc to understand why the two aren't linked 
 together...

 Thanks for the help,

 Mike
 Michael Droettboom wrote:
   
 Michael Hearne wrote:
 
 Two questions:
 1) I'm trying to upgrade an installation of matplotlib I have on a 
 RHEL5 system.  When trying:

 /usr/local/bin/python setup.py build

 I get the error message:
 gcc: src/ft2font.cpp: C++ compiler not installed on this system
 error: command 'gcc' failed with exit status 1

 I do in fact have a C++ compiler on the system, in the form of g++.  
 Is there a place where I can configure the C++ compiler to use?
   
   
 distutils will use the CXX environment variable if it is set.  Though 
 you should be able to compile C++ with gcc as well, if the C++ backend 
 is installed -- that's why the error message is surprising to me if 
 you're certain you have g++ installed.  Can you compile a simple C++ 
 file with gcc directly from the commandline?

 Cheers,
 Mike

 


 --
 Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
 powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
 easily build your RIAs with Flex Builder, the Eclipse(TM)based development
 software that enables intelligent coding and step-through debugging.
 Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   


--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] installing matplotlib

2009-03-20 Thread Michael Hearne
Trying your suggestion did not work.  However, doing this:

export CPP=/usr/bin/g++
python setup.py build

did work.  Go figure.

--Mike

Michael Droettboom wrote:
 Hmm... the selection of the compiler command is actually deep within 
 distutils -- matplotlib doesn't address it.  I'm surprised the CXX 
 environment variable isn't getting picked up.  I use that all the time 
 to test different compilers.

 Did you try:

 export CXX=/usr/bin/g++
 python setup.py build

 If that doesn't work, I'm at a loss -- you could start investigating 
 on distutils and/or gcc lists.

 Cheers,
 Mike



 Michael Hearne wrote:
 I tried setting CXX=/usr/bin/g++ in my .bashrc, but I still get the 
 same error.  Is there some file in the matplotlib distribution that I 
 need to edit with this information?

 --Mike

 Michael Hearne wrote:
 I can't using gcc, but I can using g++, which is installed.  I guess 
 I'll just set the CXX variable to the path for g++.

 I don't know enough about gcc to understand why the two aren't 
 linked together...

 Thanks for the help,

 Mike
 Michael Droettboom wrote:
  
 Michael Hearne wrote:
   
 Two questions:
 1) I'm trying to upgrade an installation of matplotlib I have on a 
 RHEL5 system.  When trying:

 /usr/local/bin/python setup.py build

 I get the error message:
 gcc: src/ft2font.cpp: C++ compiler not installed on this system
 error: command 'gcc' failed with exit status 1

 I do in fact have a C++ compiler on the system, in the form of 
 g++.  Is there a place where I can configure the C++ compiler to use?
 
 distutils will use the CXX environment variable if it is set.  
 Though you should be able to compile C++ with gcc as well, if the 
 C++ backend is installed -- that's why the error message is 
 surprising to me if you're certain you have g++ installed.  Can you 
 compile a simple C++ file with gcc directly from the commandline?

 Cheers,
 Mike

 


 --
  

 Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
 powering Web 2.0 with engaging, cross-platform capabilities. Quickly 
 and
 easily build your RIAs with Flex Builder, the Eclipse(TM)based 
 development
 software that enables intelligent coding and step-through debugging.
 Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
   




--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting thickness of axis frame

2009-02-04 Thread Michael Hearne
Chris - Thanks for your reply.  Unfortunately, it didn't seem to have 
any effect on the frame I created.

I notice with matplotlib 0.98.5.1, I get a warning with get_frame(), 
telling me to use the patch object of the axes instead of get_frame().

So, when I use this with an axes created for a Basemap, I can't get the 
thickness of the frame around the axes to change.

I'm using Basemap 0.99.2.

The code demonstrating the issue is attached, and the relevant lines of 
code are near the bottom of the script.

Thanks,

Mike

Christopher Brown wrote:
 Hi Michael,

 MH The Axes object has a method for turning on the frame:
 MH set_frame_on().   How do I set the thickness of the frame that
 MH appears?

 I use:

 plt.gca().get_frame().set_linewidth(2)



--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting thickness of axis frame

2009-02-04 Thread Michael Hearne

Forgot the attachment...


Michael Hearne wrote:
Chris - Thanks for your reply.  Unfortunately, it didn't seem to have 
any effect on the frame I created.


I notice with matplotlib 0.98.5.1, I get a warning with get_frame(), 
telling me to use the patch object of the axes instead of get_frame().


So, when I use this with an axes created for a Basemap, I can't get 
the thickness of the frame around the axes to change.


I'm using Basemap 0.99.2.

The code demonstrating the issue is attached, and the relevant lines 
of code are near the bottom of the script.


Thanks,

Mike

Christopher Brown wrote:

Hi Michael,

MH The Axes object has a method for turning on the frame:
MH set_frame_on().   How do I set the thickness of the frame that
MH appears?

I use:

plt.gca().get_frame().set_linewidth(2)






#!/usr/bin/python
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
from pylab import *

fig = plt.figure()
ax1 = fig.add_axes([0,0,1.0,1.0])
bounds = (134,144,36,40)

clon = bounds[0] + (bounds[1]-bounds[0])/2.
clat = bounds[2] + (bounds[3]-bounds[2])/2.

# setup Lambert Conformal basemap.
m = Basemap(llcrnrlon=bounds[0],llcrnrlat=bounds[2],
urcrnrlon=bounds[1],urcrnrlat=bounds[3],
resolution='h',projection='merc',lat_ts=clat)

# draw coastlines.
m.drawcoastlines()
# draw a boundary around the map, fill the background.
# this background will end up being the ocean color, since
# the continents will be drawn on top.
m.drawmapboundary(fill_color='aqua') 
# fill continents, set lake color same as ocean color. 
m.fillcontinents(color='coral',lake_color='aqua')

left = 0.05
bottom = 0.05
width = 0.25
height = 0.25
llbounds = (left,bottom,width,height)

ax = fig.add_axes(llbounds)
map = Basemap(resolution='c',
  projection='ortho',
  lon_0=clon,lat_0=clat,ax=ax)

#print 'map created.'
map.drawcountries(linewidth=0.1,color=[0.2,0.2,0.2])
map.drawcoastlines(linewidth=0.05,color=[0.2,0.2,0.2])
map.drawlsmask((230,230,230,255),(119,155,207,255))
meridians = arange(-180,210,30)
parallels = arange(-90,120,30)
map.drawmeridians(meridians,linewidth=0.1,dashes=[1,0],color=[0.2,0.2,0.2])
map.drawparallels(parallels,linewidth=0.1,dashes=[1,0],color=[0.2,0.2,0.2])
pcx,pcy = map(clon,clat)

map.plot(array([pcx]),array([pcy]),'r*',linewidth=1,markersize=5,markeredgecolor='r')
map.drawmapboundary(color='k',linewidth=2.0)

ax.set_frame_on(True)
ax.patch.set_linewidth(4.0)

plt.savefig('output.png')


--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] setting thickness of axis frame

2009-02-03 Thread Michael Hearne
The Axes object has a method for turning on the frame: set_frame_on().  
How do I set the thickness of the frame that appears?

Thanks,

Mike Hearne

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting a circle in log space

2009-01-23 Thread Michael Hearne
I have discovered, from the mailing list, the easy way to draw a circle 
in linear space:

cx = 700
cy = 700
r = 1000

xmin = cx - r
xmax = cx + r
ymin = cy - r
ymax = cy + r

cir = Circle( (cx,cx), radius=r,facecolor='w',edgecolor='b')
a = gca()
a.add_patch(cir)

axis([xmin,xmax,ymin,ymax])
axis('equal')

However, when trying to overplot a circle on an existing log/log plot, I 
get a circle section:
e = 
[70,1,1,12,7,185,6,3,0,1015,6,222,500,0,661,105,0,8706,0,23,131,0,0,0,6,22,1,4,0]
o = 
[180,2,0,15,13,3,0,0,0,20,6,2000,9748,0,38,100,0,20023,0,2,0,0,0,0,1,0,0,0,1]
f1 = figure()
loglog(o,e,'b.')
hold('on')
cx = 700
cy = 700
r = 1000

xmin = cx - r
xmax = cx + r
ymin = cy - r
ymax = cy + r

cir = Circle( (cx,cx), radius=r,facecolor='w',edgecolor='b')
a = gca()
a.add_patch(cir)

axis([xmin,xmax,ymin,ymax])
axis('equal')

How can I plot a circle in log space?

As an additional aside, I've discovered that even if I define the points 
that make up a circle (in linear space), I cannot plot a smooth line 
through them using the plot() function:
def pol2cart(th,r):
x = r*cos(th)
y = r*sin(th)
return (x,y)
   
def drawCircle(cx,cy,radius,np,style):
theta = linspace(0,2*pi,np)
rho = ones((1,np))*radius
x,y = pol2cart(theta,rho)
x = x + cx
y = y + cy
plot(x,y,style)

cx = 700
cy = 700
r = 1000
drawCircle(cx,cy,r,1000,'b')

When I look at the resulting plot, I see empty axes.  If I change the 
plot style to 'b.', then I see the circle.  Is this a bug or an 
undocumented feature?

Thanks,

Mike Hearne

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] clabel return values

2009-01-06 Thread Michael Hearne
Is the list of return values from the clabel() function supposed to 
represent the position and orientation of the contour labels?  I have a 
script below where I try to re-draw the contour labels using the Text 
objects in the list returned from clabel(), and they do not line up in 
my output.  I'm using Matplotlib version 0.98.5.1, revision 6622.

If this is intentional, is there some way of retrieving the actual 
position/orientation of the contour labels?  I'm trying to make a 
drop-shadow effect for those labels, and I need to know where they are 
exactly for my code to work.

Sample script:
#!/usr/bin/env python
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import math

matplotlib.rcParams['xtick.direction'] = 'out'
matplotlib.rcParams['ytick.direction'] = 'out'

delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)

f=plt.figure(facecolor='g')
ax = plt.gca()
ax.set_axis_bgcolor('g')
CS = plt.contour(X, Y, Z)
xt = plt.xticks()
yt = plt.yticks()

fontsize = 10
fontdict2 = {'fontweight':'light',
 'color': 'r',
 'fontsize':fontsize}
labels = plt.clabel(CS, inline=1, fontsize=fontsize,colors='k')
for label in labels:
ltext = label.get_text()
lrot = label.get_rotation()
lx,ly = label.get_position()
plt.text(lx,ly,ltext,fontdict2,rotation=lrot)

plt.savefig('output.png')


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] clabel return values

2009-01-06 Thread Michael Hearne
Jae-Joon - Thank you for your suggestion.  I wasn't aware I needed the 
alignments.

However, when I try your sample code in my script, I get a sequence of 
rendering errors if I use show() or savefig():

Traceback (most recent call last):
  File 
/Library/Python/2.5/site-packages/matplotlib-0.98.5.1-py2.5-macosx-10.5-i386.egg/matplotlib/figure.py,
 
line 772, in draw
for a in self.axes: a.draw(renderer)
  File 
/Library/Python/2.5/site-packages/matplotlib-0.98.5.1-py2.5-macosx-10.5-i386.egg/matplotlib/axes.py,
 
line 1601, in draw
a.draw(renderer)
  File 
/Library/Python/2.5/site-packages/matplotlib-0.98.5.1-py2.5-macosx-10.5-i386.egg/matplotlib/text.py,
 
line 450, in draw
bbox, info = self._get_layout(renderer)
  File 
/Library/Python/2.5/site-packages/matplotlib-0.98.5.1-py2.5-macosx-10.5-i386.egg/matplotlib/text.py,
 
line 246, in _get_layout
'lp', self._fontproperties, ismath=False)
  File 
/Library/Python/2.5/site-packages/matplotlib-0.98.5.1-py2.5-macosx-10.5-i386.egg/matplotlib/backends/backend_macosx.py,
 
line 123, in get_text_width_height_descent
return self.gc.get_text_width_height_descent(unicode(s), family, 
size, weight, style)
RuntimeError: ATSUSetAttributes failed

My new script is below:
#!/usr/bin/env python
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import math

matplotlib.rcParams['xtick.direction'] = 'out'
matplotlib.rcParams['ytick.direction'] = 'out'

delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)

f=plt.figure(facecolor='g')
ax = plt.gca()
ax.set_axis_bgcolor('g')
CS = plt.contour(X, Y, Z)
xt = plt.xticks()
yt = plt.yticks()

fontsize = 10
fontdict2 = {'fontweight':'light',
 'color': 'r',
 'fontsize':fontsize}
fp = matplotlib.font_manager.FontProperties(fontdict2)

labels = plt.clabel(CS, inline=1, fontsize=fontsize,colors='k')
for label in labels:
ltext = label.get_text()
lx,ly = label.get_position()
lrot=label.get_rotation()
va, ha = label.get_va(), label.get_ha()
t = plt.text(lx,ly,ltext, fontproperties=fp,
 rotation=lrot,va=va, ha=ha)

plt.savefig('output.png')

Jae-Joon Lee wrote:
 I guess you're missing vertical and horizontal alignment.
 Also, your font properties were not set correctly. The 4th argument of
 the text function is a color.


 fontdict2 = {'fontweight':'light',
  'color': 'r',
  'fontsize':fontsize}
 fp = FontProperties(fontdict2)

 labels = plt.clabel(CS, inline=1, fontsize=fontsize,colors='k')
 for label in labels:
 ltext = label.get_text()
 lx,ly = label.get_position()
 lrot=label.get_rotation()
 va, ha = label.get_va(), label.get_ha()
 t = plt.text(lx,ly,ltext, fontproperties=fp,
  rotation=lrot,va=va, ha=ha)

 You may simply use update_from() method.

 Anyhow, I'm not sure if you can put dorpshadow effect this way.
 Changing font weight usually changes the overall size of each glyph.

 Regards,

 -JJ


 On Tue, Jan 6, 2009 at 10:20 AM, Michael Hearne mhea...@usgs.gov wrote:
   
 Is the list of return values from the clabel() function supposed to
 represent the position and orientation of the contour labels?  I have a
 script below where I try to re-draw the contour labels using the Text
 objects in the list returned from clabel(), and they do not line up in
 my output.  I'm using Matplotlib version 0.98.5.1, revision 6622.

 If this is intentional, is there some way of retrieving the actual
 position/orientation of the contour labels?  I'm trying to make a
 drop-shadow effect for those labels, and I need to know where they are
 exactly for my code to work.

 Sample script:
 #!/usr/bin/env python
 import matplotlib
 import numpy as np
 import matplotlib.cm as cm
 import matplotlib.mlab as mlab
 import matplotlib.pyplot as plt
 import math

 matplotlib.rcParams['xtick.direction'] = 'out'
 matplotlib.rcParams['ytick.direction'] = 'out'

 delta = 0.025
 x = np.arange(-3.0, 3.0, delta)
 y = np.arange(-2.0, 2.0, delta)
 X, Y = np.meshgrid(x, y)
 Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
 Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
 # difference of Gaussians
 Z = 10.0 * (Z2 - Z1)

 f=plt.figure(facecolor='g')
 ax = plt.gca()
 ax.set_axis_bgcolor('g')
 CS = plt.contour(X, Y, Z)
 xt = plt.xticks()
 yt = plt.yticks()

 fontsize = 10
 fontdict2 = {'fontweight':'light',
 'color': 'r',
 'fontsize':fontsize}
 labels = plt.clabel(CS, inline=1, fontsize=fontsize,colors='k')
 for label in labels:
ltext = label.get_text()
lrot = label.get_rotation()
lx,ly = label.get_position()
plt.text(lx,ly,ltext,fontdict2,rotation=lrot)

 plt.savefig('output.png

[Matplotlib-users] getting text size _before_ plotting

2009-01-05 Thread Michael Hearne
All:  I'm trying to make a map (using Basemap), and plot names of cities 
on that map.  I'd like to avoid collisions of city names (where the 
bounding boxes of the text objects would overlap), but I'm having 
trouble figuring out how I can do this without actually drawing the text 
on the figure.

I found this thread:

http://osdir.com/ml/python.matplotlib.general/2005-02/msg00174.html

which describes how to do it _after_ drawing the text on the plot.  This 
would only be useful to me if there were some way to un-draw the text, 
which isn't something I know how to do either.

Figure resizing is not a problem for my application.

Java has a FontMetrics class, which tells you how big a string will be 
in a given font - is there an equivalent for Matplotlib?

--Mike

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] making continuous color images with custom colormaps

2008-12-30 Thread Michael Hearne
I am posting yet another question about colormaps, as I am having 
trouble grasping the fundamentals of the way the color model works in 
Matplotlib.

There are many examples on-line of very nice looking continuous color 
images, such as the one that would be produced by using this code:

/delta = 0.005
extent = (-3,4,-4,3)

x = arange(-3.0, 4.001, delta)
y = arange(-4.0, 3.001, delta)
X, Y = meshgrid(x, y)
Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = (Z1 - Z2) * 10

#normalize the example Z data to be between 0 and 10
Z = ((Z - Z.min())/(Z.max() - Z.min()))*10
jet()
imshow(Z)
show()

/However, I can't find any similar examples for custom colormaps.  Below 
is some test code I wrote to try to understand this.  In it I have 
hard-coded a color dictionary (suitable for use with a 
LinearSegmentedColormap), a color list (suitable for use with a 
ListedColormap), and an array of Z values (appropriate for a Boundary 
norm).  I have tried various combinations of Listed and LinearSegmented 
colormaps, and they either show patches of very discrete colors, or no 
colors, or the resulting image blows up when I call savefig().

My goal here is to display the Z data in a continuous colormap where the 
values are interpolated according to either the color dictionary or 
color list I have defined.

A final side question:  Does a tutorial on the matplotlib color model 
exist anywhere?  This would be a really useful resource for me, and 
perhaps for others.

Code is appended below.

Thanks,

Mike

#!/usr/bin/env python
'''
Trying to figure out how to make a smooth continuous image with my 
custom colormap
'''
from pylab import *
from matplotlib.colors import 
ListedColormap,LinearSegmentedColormap,Normalize,BoundaryNorm

isListed = True

delta = 0.005
extent = (-3,4,-4,3)

x = arange(-3.0, 4.001, delta)
y = arange(-4.0, 3.001, delta)
X, Y = meshgrid(x, y)
Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = (Z1 - Z2) * 10

#normalize the example Z data to be between 0 and 10 (to match my 
colormap data)
Z = ((Z - Z.min())/(Z.max() - Z.min()))*10


cdict = {'blue': [1.0,
  1.0,
  1.0,
  1.0,
  1.0,
  0.57647058823529407,
  0.0,
  0.0,
  0.0,
  0.0,
  0.0,
  0.0],
 'green': [1.0,
   1.0,
   0.80004,
   0.90196078431372551,
   1.0,
   1.0,
   1.0,
   0.78431372549019607,
   0.56862745098039214,
   0.0,
   0.0,
   0.0],
 'red': [1.0,
 1.0,
 0.74901960784313726,
 0.62745098039215685,
 0.50196078431372548,
 0.47843137254901963,
 1.0,
 1.0,
 1.0,
 1.0,
 0.78431372549019607,
 0.50196078431372548]}


clist = array([[ 1.,  1.,  1.],
   [ 1.,  1.,  1.],
   [ 0.74901961,  0.8   ,  1.],
   [ 0.62745098,  0.90196078,  1.],
   [ 0.50196078,  1.,  1.],
   [ 0.47843137,  1.,  0.57647059],
   [ 1.,  1.,  0.],
   [ 1.,  0.78431373,  0.],
   [ 1.,  0.56862745,  0.],
   [ 1.,  0.,  0.],
   [ 0.78431373,  0.,  0.],
   [ 0.50196078,  0.,  0.]])

boundaries = array([  0.,   1.,   2.,   3.,   4.,   5.,   6.,   7.,   
8.,   9.,  10., 13.])

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] making continuous color images with custom colormaps

2008-12-30 Thread Michael Hearne
Looking at Eric's documentation, I now understand that my cdict will not 
work.  I retract my question for now until I can figure out how to make 
a cdict that looks like what I want.

Thanks.
Eric Firing wrote:
 Michael Hearne wrote:
 I am posting yet another question about colormaps, as I am having 
 trouble grasping the fundamentals of the way the color model works in 
 Matplotlib.

 Mike,

 I recently added examples/pylab_examples/custom_cmap.py with an 
 extensive docstring, partly stolen from the cookbook, to try to 
 explain and illustrate the use of LinearSegmentedColormap.

 examples/api/colorbar_only.py gives an example of a ListedColormap, 
 although it sounds to me like what you want really is the 
 LinearSegmentedColormap.

 Eric


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] error installing matplotlib from egg

2008-12-16 Thread Michael Hearne
 option -Wstrict-prototypes is valid for 
C/ObjC but not for C++
cc1plus: warning: command line option -Wstrict-prototypes is valid for 
C/ObjC but not for C++
cc1plus: warning: command line option -Wstrict-prototypes is valid for 
C/ObjC but not for C++
ld: warning in /sw/lib/libpng12.dylib, file is not of required architecture
cc1plus: warning: command line option -Wstrict-prototypes is valid for 
C/ObjC but not for C++
cc1plus: warning: command line option -Wstrict-prototypes is valid for 
C/ObjC but not for C++
powerpc-apple-darwin9-gcc-4.0.1: -framework: linker input file unused 
because linking not done
powerpc-apple-darwin9-gcc-4.0.1: Tcl: linker input file unused because 
linking not done
powerpc-apple-darwin9-gcc-4.0.1: -framework: linker input file unused 
because linking not done
powerpc-apple-darwin9-gcc-4.0.1: Tk: linker input file unused because 
linking not done
i686-apple-darwin9-gcc-4.0.1: -framework: linker input file unused 
because linking not done
i686-apple-darwin9-gcc-4.0.1: Tcl: linker input file unused because 
linking not done
i686-apple-darwin9-gcc-4.0.1: -framework: linker input file unused 
because linking not done
i686-apple-darwin9-gcc-4.0.1: Tk: linker input file unused because 
linking not done
ld: warning in /sw/lib/freetype219/lib/libfreetype.dylib, file is not of 
required architecture
zip_safe flag not set; analyzing archive contents...
matplotlib.__init__: module references __file__
matplotlib.pyparsing: module MAY be using inspect.stack
matplotlib.backends.backend_cocoaagg: module references __file__
matplotlib.config.cutils: module references __file__
Removing matplotlib 0.98.5.1 from easy-install.pth file
Adding matplotlib 0.98.5.1 to easy-install.pth file

Installed 
/Library/Python/2.5/site-packages/matplotlib-0.98.5.1-py2.5-macosx-10.5-i386.egg
Finished processing dependencies for matplotlib==0.98.5.1
Exception exceptions.OSError: (2, 'No such file or directory', 
'src/image.cpp') in bound method CleanUpFile.__del__ of 
setupext.CleanUpFile instance at 0x14c5aa8 ignored
Exception exceptions.OSError: (2, 'No such file or directory', 
'src/path.cpp') in bound method CleanUpFile.__del__ of 
setupext.CleanUpFile instance at 0x14c5300 ignored
Exception exceptions.OSError: (2, 'No such file or directory', 
'src/backend_agg.cpp') in bound method CleanUpFile.__del__ of 
setupext.CleanUpFile instance at 0x14c55f8 ignored

John Hunter wrote:
 On Mon, Dec 15, 2008 at 7:08 PM, Michael Hearne mhea...@usgs.gov wrote:
   
 I get the following output when trying to install the latest version of
 matplotlib from an egg.  I'm running Mac OS X 10.5.5.
 

 We've had a lot of trouble with our eggs.  I am not sure this is all
 our fault, because it looks like some combination of distutils and
 setuptools is breaking in the presence of symlinks, which we use.  I'm
 modified our installs to work around this problem, and have posted new
 eggs at

   
 https://sourceforge.net/project/showfiles.php?group_id=80706package_id=278194release_id=646644

 You have two choices for OS X :

   * matplotlib-0.98.5.1-py2.5-macosx10.5.zip   - a binary mpkg installer
   * matplotlib-0.98.5.1-py2.5-macosx.egg  - an egg with the known
 problems fixed.

 Please give it another whirl and let me know.

 JDH
   


--
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] GMT-like color maps

2008-12-16 Thread Michael Hearne
I'm trying to replicate the color-mapping behavior of the GMT package 
with matplotlib/basemap and the imshow() function, and have run into a 
problem.


Using GMT you can assign colors to ranges of Z values, so that (for 
example), Z values between 0 and 50 are given a color interpolated 
between  (0,0,255) (blue) and (255,0,0) (red).  There have been various 
versions of a function called gmtColorMap() posted to this list.  I did 
some experiments today, and as far as I can tell, this function only 
reads the _color_ part of a GMT .cpt file, ignoring the Z values to 
which those color ranges are assigned.  This isn't a problem as long as 
you have a linear color scale.  However, if you have (as in my case) a 
color scale assigned to non-linear ranges of values, it becomes a problem.


Is there a way with imshow() to assign ranges of colors to specific 
ranges of Z values?


As a test, I created the attached python script, which reads in the 
attached .cpt file.


For those of you not aware of the GMT color palette file format, in each 
row you define two end points for your Z values, and two corresponding 
RGB triplets.  In my simplified example, I have defined 8 ranges, and 
assigned a single color to each range.  For example, the first two lines 
in my color palette file looks like this:


0 255 255 255 5 255 255 255
5 255 255 000 00050 255 255 000

which can be interpreted to mean that any values between 0 and 5 (filled 
in with zeros to make the columns line up), should be colored white.  
Similarly, any values between 5 and 50 should be colored yellow.










popcpt.cpt
Description: Binary data
#!/usr/bin/python

from matplotlib.colors import LinearSegmentedColormap,Normalize
from pylab import *

def gmtColormap(fileName):
  import colorsys
  import numpy as N
  try:
  f = open(fileName)
  except:
  print file ,fileName, not found
  return None

  lines = f.readlines()
  f.close()

  x = []
  r = []
  g = []
  b = []
  colorModel = RGB
  for l in lines:
  ls = l.split()
  if l[0] == #:
 if ls[-1] == HSV:
 colorModel = HSV
 continue
 else:
 continue
  if ls[0] == B or ls[0] == F or ls[0] == N:
 pass
  else:
  x.append(float(ls[0]))
  r.append(float(ls[1]))
  g.append(float(ls[2]))
  b.append(float(ls[3]))
  xtemp = float(ls[4])
  rtemp = float(ls[5])
  gtemp = float(ls[6])
  btemp = float(ls[7])

  x.append(xtemp)
  r.append(rtemp)
  g.append(gtemp)
  b.append(btemp)

  nTable = len(r)
  x = N.array( x , N.float32)
  r = N.array( r , N.float32)
  g = N.array( g , N.float32)
  b = N.array( b , N.float32)
  if colorModel == HSV:
 for i in range(r.shape[0]):
 rr,gg,bb = colorsys.hsv_to_rgb(r[i]/360.,g[i],b[i])
 r[i] = rr ; g[i] = gg ; b[i] = bb
  if colorModel == HSV:
 for i in range(r.shape[0]):
 rr,gg,bb = colorsys.hsv_to_rgb(r[i]/360.,g[i],b[i])
 r[i] = rr ; g[i] = gg ; b[i] = bb
  if colorModel == RGB:
  r = r/255.
  g = g/255.
  b = b/255.
  xNorm = (x - x[0])/(x[-1] - x[0])

  red = []
  blue = []
  green = []
  for i in range(len(x)):
  red.append([xNorm[i],r[i],r[i]])
  green.append([xNorm[i],g[i],g[i]])
  blue.append([xNorm[i],b[i],b[i]])
  colorDict = {red:red, green:green, blue:blue}
  return (colorDict)

colormap = 'popcpt.cpt'
cdict = gmtColormap(colormap)
palette = LinearSegmentedColormap('my_colormap',cdict)

f = figure()
data = array([[2,2,2,2,2],
 [25,25,25,25,25],
 [75,75,75,75,75],
 [250,250,250,250,250],
 [750,750,750,750,750],
 [2500,2500,2500,2500,2500],
 [7500,7500,7500,7500,7500],
 [25000,25000,25000,25000,25000]])
imshow(data,cmap=palette)
#draw grid lines around all the cells
nrows,ncols = data.shape
for row in range(0,nrows):
plot([0,ncols],[row,row],'k')
for col in range(0,ncols):
plot([col,col],[0,nrows],'k')
axis([0,ncols-1,0,nrows])
colorbar()
savefig('output.png')
close('all') 
--
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] error installing matplotlib from egg

2008-12-15 Thread Michael Hearne
I get the following output when trying to install the latest version of 
matplotlib from an egg.  I'm running Mac OS X 10.5.5.


sudo easy_install matplotlib-0.98.5-py2.5-macosx-10.3.egg
Processing matplotlib-0.98.5-py2.5-macosx-10.3.egg
removing 
'/Library/Python/2.5/site-packages/matplotlib-0.98.5-py2.5-macosx-10.3.egg' 
(and everything under it)
creating 
/Library/Python/2.5/site-packages/matplotlib-0.98.5-py2.5-macosx-10.3.egg
Extracting matplotlib-0.98.5-py2.5-macosx-10.3.egg to 
/Library/Python/2.5/site-packages
matplotlib 0.98.5 is already the active version in easy-install.pth

Installed 
/Library/Python/2.5/site-packages/matplotlib-0.98.5-py2.5-macosx-10.3.egg
Processing dependencies for matplotlib==0.98.5
Searching for matplotlib==0.98.5
Reading http://pypi.python.org/simple/matplotlib/
Reading http://matplotlib.sourceforge.net
Reading 
https://sourceforge.net/project/showfiles.php?group_id=80706package_id=278194
Reading 
https://sourceforge.net/project/showfiles.php?group_id=80706package_id=82474
Reading http://sourceforge.net/project/showfiles.php?group_id=80706
Best match: matplotlib 0.98.5
Downloading 
http://downloads.sourceforge.net/matplotlib/matplotlib-0.98.5.tar.gz?modtime=1229034572big_mirror=0
Processing matplotlib-0.98.5.tar.gz
Running matplotlib-0.98.5/setup.py -q bdist_egg --dist-dir 
/var/folders/GK/GKdPFArAGq0lmR1STz+kRTQ/-Tmp-/easy_install-3-LaUu/matplotlib-0.98.5/egg-dist-tmp-5updhB

BUILDING MATPLOTLIB
matplotlib: 0.98.5
python: 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)  [GCC
4.0.1 (Apple Inc. build 5465)]
  platform: darwin

REQUIRED DEPENDENCIES
 numpy: 1.1.0.dev5077
 freetype2: 9.17.3

OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.18
   Tkinter: Tkinter: 50704, Tk: 8.4, Tcl: 8.4
  wxPython: 2.8.4.0
* WxAgg extension not required for wxPython = 2.8
  Gtk+: no
* Building for Gtk+ requires pygtk; you must be able
* to import gtk in your build/install environment
   Mac OS X native: yes
Qt: no
   Qt4: no
 Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
  datetime: present, version unknown
  dateutil: 1.4.1
  pytz: 2008i

OPTIONAL USETEX DEPENDENCIES
dvipng: no
   ghostscript: 8.61
 latex: no

EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES
 configobj: matplotlib will provide
  enthought.traits: 2.6b1-mpl

[Edit setup.cfg to suppress the above messages]

error: lib/matplotlib/mpl-data/matplotlib.conf.template: No such file or 
directory
Exception exceptions.OSError: (2, 'No such file or directory', 
'src/image.cpp') in bound method CleanUpFile.__del__ of 
setupext.CleanUpFile instance at 0x1447b48 ignored
Exception exceptions.OSError: (2, 'No such file or directory', 
'src/path.cpp') in bound method CleanUpFile.__del__ of 
setupext.CleanUpFile instance at 0x14473a0 ignored
Exception exceptions.OSError: (2, 'No such file or directory', 
'src/backend_agg.cpp') in bound method CleanUpFile.__del__ of 
setupext.CleanUpFile instance at 0x1447698 ignored

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


Re: [Matplotlib-users] building matplotib on linux

2008-09-23 Thread Michael Hearne
I installed the freetype-devel libraries and this problem went away.

--Mike

Michael Hearne wrote:
 All:  I am trying to build matplotlib 0.98.3 on a Red Hat Enterprise 5 
 linux box.  I have Tkinter support compiled into my 
 /usr/local/bin/python installation (at least import Tkinter raises 
 no exceptions).  However, when I try to build matplotlib using 
 /usr/local/bin/python setup.py build, I get the output below.  Any 
 hints?  Is this my fault, or a bug in setup.py?

 Thanks,

 Mike

  

 BUILDING MATPLOTLIB
matplotlib: 0.98.3
python: 2.5.2 (r252:60911, Sep 15 2008, 16:18:30)  [GCC
4.1.2 20071124 (Red Hat 4.1.2-42)]
  platform: linux2

 REQUIRED DEPENDENCIES
 numpy: 1.1.0
 freetype2: found, but unknown version (no pkg-config)
* WARNING: Could not find 'freetype2' headers 
 in any
* of '/usr/local/include', '/usr/include', '.',
* '/usr/local/include/freetype2',
* '/usr/include/freetype2', './freetype2'.

 OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.10
 Traceback (most recent call last):
  File setup.py, line 125, in module
if check_for_tk() or (options['build_tkagg'] is True):
  File /home/mhearne/build/matplotlib-0.98.3/setupext.py, line 841, 
 in check_for_tk
explanation = add_tk_flags(module)
  File /home/mhearne/build/matplotlib-0.98.3/setupext.py, line 1101, 
 in add_tk_flags
module.libraries.extend(['tk' + tk_ver, 'tcl' + tk_ver])
 UnboundLocalError: local variable 'tk_ver' referenced before assignment


-- 
--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
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] building matplotib on linux

2008-09-23 Thread Michael Hearne
No.  Interestingly, I didn't get the same errors this morning as I did 
last night - I got build errors regarding ftbuild (or something like 
that).  I had just installed Tcl/Tk from source, so perhaps the first 
time my shell hadn't figured out where they were (??).   After I 
installed freetype-devel, the build errors went away.  The Tk errors 
vanished on their own.

I don't know why I have so much trouble building and installing software...

Thanks,

Mike Hearne


John Hunter wrote:
 On Tue, Sep 23, 2008 at 10:28 AM, Michael Hearne [EMAIL PROTECTED] wrote:
   
 I installed the freetype-devel libraries and this problem went away.

 

 Any chance you also installed tk-devel or tcl-devel?  I can't see how
 the addition of the freetype headers would fix a tk problem.

 JDH
   

-- 
--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
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] building matplotib on linux

2008-09-22 Thread Michael Hearne
All:  I am trying to build matplotlib 0.98.3 on a Red Hat Enterprise 5 
linux box.  I have Tkinter support compiled into my 
/usr/local/bin/python installation (at least import Tkinter raises no 
exceptions).  However, when I try to build matplotlib using 
/usr/local/bin/python setup.py build, I get the output below.  Any 
hints?  Is this my fault, or a bug in setup.py?

Thanks,

Mike


BUILDING MATPLOTLIB
matplotlib: 0.98.3
python: 2.5.2 (r252:60911, Sep 15 2008, 16:18:30)  [GCC
4.1.2 20071124 (Red Hat 4.1.2-42)]
  platform: linux2

REQUIRED DEPENDENCIES
 numpy: 1.1.0
 freetype2: found, but unknown version (no pkg-config)
* WARNING: Could not find 'freetype2' headers in any
* of '/usr/local/include', '/usr/include', '.',
* '/usr/local/include/freetype2',
* '/usr/include/freetype2', './freetype2'.

OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.10
Traceback (most recent call last):
  File setup.py, line 125, in module
if check_for_tk() or (options['build_tkagg'] is True):
  File /home/mhearne/build/matplotlib-0.98.3/setupext.py, line 841, in 
check_for_tk
explanation = add_tk_flags(module)
  File /home/mhearne/build/matplotlib-0.98.3/setupext.py, line 1101, 
in add_tk_flags
module.libraries.extend(['tk' + tk_ver, 'tcl' + tk_ver])
UnboundLocalError: local variable 'tk_ver' referenced before assignment

-- 
--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
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] bug in savefig?

2008-09-11 Thread Michael Hearne
Has anyone reported a bug in the post-script renderer regarding text 
with backticks in it?  I remember that there was a bug fix for single 
quotes, but I just ran into this one.

I'm using 0.98.2 on OS 10.5.

A sample script is below.  If I try to open the postscript file in Mac's 
Preview, it attempts to convert it to a PDF before viewing and fails.  
Similarly, if I try to convert it using ps2pdf, it also fails.

#!/usr/bin/python

from pylab import *

x = array([1,2,3,4])
y = array([5,6,7,8])
plot(x,y,'r+')
hold(True)
text(2,7,El `Jamar)
savefig('output.eps')
savefig('output.png')

-- 
--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
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] which basemap with matpotlib 0.91.2

2008-08-11 Thread Michael Hearne
Jeff - Well, that's the problem  - I _do_ need scipy!  Not for basemap, 
but for the rest of my application.  Does your sourceforge repository 
have older copies of  the basemap code?

My complaint about scipy has to do with the fact that I spent a good 
week trying to get scipy's dependencies to install on two Red Hat 
Enterprise Linux systems:  I punted both of them over to an outside 
contractor, who was able to compile scipy on one system, but not the 
other.  And he specializes in that kind of stuff.

--Mike

Jeff Whitaker wrote:
 Michael Hearne wrote:
 I'm trying to build an application on a newly installed Ubuntu.  I've 
 used apt-get to install scipy and matplotlib.

 numpy version: 1.0.4
 scipy version: 0.6
 matplotlib version: 0.91.2

 What version of basemap is safe to download and build with this 
 configuration?  Doing apt-cache search basemap yields no results, 
 so I assume there isn't an Ubuntu package for that.

 And if someone tells me I need to compile a newer scipy (and it's 
 #$%^! dependencies) from source, I'll scream.

 Thanks,

 Mike

   
 Mike:  Basemap's now only supported  for matplotlib  0.98.  For that 
 you need numpy 1.1 (you don't need scipy at all).
 -Jeff


-- 
--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
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] bug: fewer colors in encapsulated postscript versions than PNG

2008-06-27 Thread Michael Hearne
I noticed a problem with colors in rendered encapsulated postscript 
files, and fortunately I was able to replicate with a modified version 
of one of Jeff Whitaker's example scripts, which I have attached.  The 
EPS version of the plot has black contour lines where they are colored 
in the PNG file, at least on a Mac OSX machine.


Is there a work-around for this?  I haven't tested to see if it is 
limited to contour plots, or to Mac installations...


Thanks,

Mike

--
--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--

from mpl_toolkits.basemap import Basemap
import pylab as p
# set up orthographic map projection with
# perspective of satellite looking down at 50N, 100W.
# use low resolution coastlines.
map = Basemap(projection='ortho',lat_0=50,lon_0=-100,resolution='l')
# draw coastlines, country boundaries, fill continents.
map.drawcoastlines(linewidth=0.25)
map.drawcountries(linewidth=0.25)
map.fillcontinents(color='coral')
# draw the edge of the map projection region (the projection limb)
map.drawmapboundary()
# draw lat/lon grid lines every 30 degrees.
map.drawmeridians(p.arange(0,360,30))
map.drawparallels(p.arange(-90,90,30))
# lat/lon coordinates of five cities.
lats=[40.02,32.73,38.55,48.25,17.29]
lons=[-105.16,-117.16,-77.00,-114.21,-88.10]
cities=['Boulder, CO','San Diego, CA',
'Washington, DC','Whitefish, MT','Belize City, Belize']
# compute the native map projection coordinates for cities.
x,y = map(lons,lats)
# plot filled circles at the locations of the cities.
map.plot(x,y,'bo')
# plot the names of those five cities.
for name,xpt,ypt in zip(cities,x,y):
p.text(xpt+5,ypt+5,name,fontsize=9)
# make up some data on a regular lat/lon grid.
nlats = 73; nlons = 145; delta = 2.*p.pi/(nlons-1)
lats = (0.5*p.pi-delta*p.indices((nlats,nlons))[0,:,:])
lons = (delta*p.indices((nlats,nlons))[1,:,:])
wave = 0.75*(p.sin(2.*lats)**8*p.cos(4.*lons))
mean = 0.5*p.cos(2.*lats)*((p.sin(2.*lats))**2 + 2.)
# compute native map projection coordinates of lat/lon grid.
x, y = map(lons*180./p.pi, lats*180./p.pi)
# contour data over the map.
cs = map.contour(x,y,wave+mean,15,linewidths=1.5)

# as above, but use blue marble image as map background.
fig = p.figure()
map = Basemap(projection='ortho',lat_0=50,lon_0=-100,resolution='l')
map.drawmapboundary()
map.drawmeridians(p.arange(0,360,30))
map.drawparallels(p.arange(-90,90,30))
# lat/lon coordinates of five cities.
lats=[40.02,32.73,38.55,48.25,17.29]
lons=[-105.16,-117.16,-77.00,-114.21,-88.10]
cities=['Boulder, CO','San Diego, CA',
'Washington, DC','Whitefish, MT','Belize City, Belize']
# compute the native map projection coordinates for cities.
x,y = map(lons,lats)
# plot filled circles at the locations of the cities.
map.plot(x,y,'yo')
# plot the names of those five cities.
for name,xpt,ypt in zip(cities,x,y):
p.text(xpt+5,ypt+5,name,fontsize=9,color='w')
# make up some data on a regular lat/lon grid.
nlats = 73; nlons = 145; delta = 2.*p.pi/(nlons-1)
lats = (0.5*p.pi-delta*p.indices((nlats,nlons))[0,:,:])
lons = (delta*p.indices((nlats,nlons))[1,:,:])
wave = 0.75*(p.sin(2.*lats)**8*p.cos(4.*lons))
mean = 0.5*p.cos(2.*lats)*((p.sin(2.*lats))**2 + 2.)
# compute native map projection coordinates of lat/lon grid.
x, y = map(lons*180./p.pi, lats*180./p.pi)
# contour data over the map.
cs = map.contour(x,y,wave+mean,15,linewidths=1.5)
# draw blue marble image in background.
#map.bluemarble()
#p.show()

p.savefig('wiki_example.eps')
p.savefig('wiki_example.png')
p.close('all')

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bug: fewer colors in encapsulated postscript versions than PNG

2008-06-27 Thread Michael Hearne
I upgraded using svn, and it solved the problem.  Thanks for the tip!

--Mike

Michael Droettboom wrote:
 There have subsequently been a number of fixes to how state is saved 
 and restored in the Postscript backend.  (Especially in revisions 
 5082, 5083 and 5133).  Comparing your eps file with mine, that seems 
 the most likely culprit of the bug.  Can you update to 0.98.1 or later 
 (or the current SVN head?).  Does that resolve this issue?

 Cheers,
 Mike

 Michael Hearne wrote:
 Matplotlib versions:

 In [2]: matplotlib.__version__
 Out[2]: '0.98pre'

 In [3]: matplotlib.__revision__
 Out[3]: '$Revision: 5075 $'

 And I get similar results with the contour_demo example in the 
 matplotlib distribution.

 The .eps (and .png, for comparison) file for that is attached.

 --Mike

 Michael Droettboom wrote:
 What version of matplotlib are you using?

 Can you provide a standalone example that doesn't rely on basemap?  
 If not, can you provide the .eps file so we can have a look?

 Colored lines on contour plots in EPS works fine here 
 (contour_demo.py) (with matplotlib 0.98.2 on a Linux box).

 Cheers,
 Mike

 Michael Hearne wrote:
 I noticed a problem with colors in rendered encapsulated postscript 
 files, and fortunately I was able to replicate with a modified 
 version of one of Jeff Whitaker's example scripts, which I have 
 attached.  The EPS version of the plot has black contour lines 
 where they are colored in the PNG file, at least on a Mac OSX machine.

 Is there a work-around for this?  I haven't tested to see if it is 
 limited to contour plots, or to Mac installations...

 Thanks,

 Mike

  


 - 

 Check out the new SourceForge.net Marketplace.
 It's the best place to buy or sell services for
 just about anything Open Source.
 http://sourceforge.net/services/buy/index.php
  


 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Errors building matplotlib on RHEL5

2008-06-25 Thread Michael Hearne
I'm trying to install matplotlib on a RHEL5 system, and I'm getting 
errors in src/ft2font.h and ft2font.cpp.


An error log from the build command is attached.

I would use an RPM for this platform if I were sure that it would be 
installed in /usr/local/lib...  Is there a way to control where RPM's 
get installed?


--Mike

--
--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--

cc1plus: warning: command line option -Wstrict-prototypes is valid for 
Ada/C/ObjC but not for C++
In file included from src/ft2font.cpp:1:
src/ft2font.h:13:22: error: ft2build.h: No such file or directory
src/ft2font.h:14:10: error: #include expects FILENAME or FILENAME
src/ft2font.h:15:10: error: #include expects FILENAME or FILENAME
src/ft2font.h:16:10: error: #include expects FILENAME or FILENAME
src/ft2font.h:17:10: error: #include expects FILENAME or FILENAME
src/ft2font.h:18:10: error: #include expects FILENAME or FILENAME
src/ft2font.h:31: error: ‘FT_Bitmap’ has not been declared
src/ft2font.h:31: error: ‘FT_Int’ has not been declared
src/ft2font.h:31: error: ‘FT_Int’ has not been declared
src/ft2font.h:77: error: expected ‘,’ or ‘...’ before ‘’ token
src/ft2font.h:77: error: ISO C++ forbids declaration of ‘FT_Face’ with no 
type
src/ft2font.h:83: error: expected ‘,’ or ‘...’ before ‘’ token
src/ft2font.h:83: error: ISO C++ forbids declaration of ‘FT_Face’ with no 
type
src/ft2font.h:122: error: ‘FT_Face’ does not name a type
src/ft2font.h:123: error: ‘FT_Matrix’ does not name a type
src/ft2font.h:124: error: ‘FT_Vector’ does not name a type
src/ft2font.h:125: error: ‘FT_Error’ does not name a type
src/ft2font.h:126: error: ‘FT_Glyph’ was not declared in this scope
src/ft2font.h:126: error: template argument 1 is invalid
src/ft2font.h:126: error: template argument 2 is invalid
src/ft2font.h:127: error: ‘FT_Vector’ was not declared in this scope
src/ft2font.h:127: error: template argument 1 is invalid
src/ft2font.h:127: error: template argument 2 is invalid
src/ft2font.h:133: error: ‘FT_BBox’ does not name a type
src/ft2font.cpp:46: error: ‘FT_Library’ does not name a type
src/ft2font.cpp:97: error: variable or field ‘draw_bitmap’ declared void
src/ft2font.cpp:97: error: ‘int FT2Image::draw_bitmap’ is not a static 
member of ‘class FT2Image’
src/ft2font.cpp:97: error: ‘FT_Bitmap’ was not declared in this scope
src/ft2font.cpp:97: error: ‘bitmap’ was not declared in this scope
src/ft2font.cpp:98: error: ‘FT_Int’ was not declared in this scope
src/ft2font.cpp:99: error: ‘FT_Int’ was not declared in this scope
src/ft2font.cpp:99: error: initializer expression list treated as compound 
expression
src/ft2font.cpp:99: error: expected ‘,’ or ‘;’ before ‘{’ token
/usr/local/lib/python2.5/site-packages/numpy-1.1.0-py2.5-linux-x86_64.egg/numpy/core/include/numpy/__multiarray_api.h:958:
 warning: ‘int _import_array()’ defined but not used
error: command 'gcc' failed with exit status 1
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [Fwd: bounding box functionality with text() function]

2008-06-11 Thread Michael Hearne
I'm reposting this, as it may have gotten lost in other discussions.  I 
think there is possibly a bug in the PNG renderer for TkAgg (which is 
what I think I'm using when I say matplotlib.use('agg')), as I get 
different visual results from savefig when saving to EPS and PNG. If 
this isn't a bug, can someone please let me know what I'm doing wrong, 
or point me to a workaround for saving to PNG files?

Thanks,

Mike

 Original Message 
Subject:[Matplotlib-users] bounding box functionality with text() 
function
Date:   Mon, 09 Jun 2008 14:35:24 -0600
From:   Michael Hearne [EMAIL PROTECTED]
Reply-To:   [EMAIL PROTECTED]
To: MatPlotLib Users matplotlib-users@lists.sourceforge.net



I'm having a problem with the bbox keyword to the text() function.  The 
code below, for me, results in one postscript file that looks fine, but 
the PNG file has letters outside of the bounding box for most of the 
words I plot.

I'm using matplotlib '0.98pre' on Mac OS X.

import matplotlib
matplotlib.use('agg')
from pylab import *

x = array([6,7,8,9,10])
y = array([6,7,8,9,10])
fig = figure()
plot(x,y,'rx')
hold('on')
fontdict2 = {'fontweight':'light',
 'color': 'k',
 'fontsize':9}
words = ['Hi','Goodbye','What''s this','Aloha','So long, farewell']
for i in range(0,len(x)):
tx = x[i]
ty = y[i]
word = words[i]
text(tx,ty,word,fontdict2,bbox={'facecolor':'w'})

savefig('textplot.eps')
savefig('textplot.png')
close(fig)

-- 
--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bounding box functionality with text() function

2008-06-11 Thread Michael Hearne
John - Thanks for the quick fix.  I'm having a separate issue now with 
an EPS file being generated (using savefig() again) that appears to be 
invalid (can't display it in OS X Preview, or convert to PDF with 
ps2pdf).  Unfortunately, the code that creates this particular file is 
rather involved, and hard to replicate with one simple script.

If I send the offending EPS file (it's 1.4 MB zipped), is it possible to 
tell from that what the problem is?

The errors from ps2pdf are:
Error: /undefined in --get--
Operand stack:
   true   --dict:43/43(ro)(L)--   .notdef
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   
--nostringval--   2   %stopped_push   --nostringval--   
--nostringval--   --nostringval--   false   1   %stopped_push   1905   
1   3   %oparray_pop   1904   1   3   %oparray_pop   --nostringval--   
1888   1   3   %oparray_pop   1771   1   3   %oparray_pop   
--nostringval--   %errorexec_pop   .runexec2   --nostringval--   
--nostringval--   --nostringval--   2   %stopped_push   
--nostringval--   %finish_show   --nostringval--   --nostringval--   5   
4   0   --nostringval--   (pdf_text_enum_t)   %op_show_continue   
--nostringval--
Dictionary stack:
   --dict:1144/1684(ro)(G)--   --dict:0/20(G)--   --dict:75/200(L)--   
--dict:61/112(L)--   --dict:20/25(ro)(L)--
Current allocation mode is local
Last OS error: 2
Current file position is 996122
GPL Ghostscript 8.61: Unrecoverable error, exit code 1

--Mike

John Hunter wrote:
 On Wed, Jun 11, 2008 at 10:14 AM, John Hunter [EMAIL PROTECTED] wrote:

   
 Interesting.  When I plot it on my screen it looks correct with a *Agg
 GUI backend.  But when I save it (either from the GUI or using
 savefig) it has the problem you describe.  This suggests to me that
 either some cached information or something is not getting notified of
 the different default dpi in savefig.  I'll look into it.  Since PS is
 dpi independent, it would not affect it.
 

 Well, my diagnosis wasn't correct, but I fixed the problem.  In the
 caching of the text layout, we were not taking into account the
 different renderers in the cache key.  Since PS has a nominal dpi
 setting that is ignored by postscript, the differences in dpi were not
 getting picked up in the layout cache.  The solution I implemented was
 to simply add the renderer id to the property tuple used for caching.
 Fixed in svn r5470.

 JDH
   

-- 
--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] bounding box functionality with text() function

2008-06-09 Thread Michael Hearne
I'm having a problem with the bbox keyword to the text() function.  The 
code below, for me, results in one postscript file that looks fine, but 
the PNG file has letters outside of the bounding box for most of the 
words I plot.

I'm using matplotlib '0.98pre' on Mac OS X.

import matplotlib
matplotlib.use('agg')
from pylab import *

x = array([6,7,8,9,10])
y = array([6,7,8,9,10])
fig = figure()
plot(x,y,'rx')
hold('on')
fontdict2 = {'fontweight':'light',
 'color': 'k',
 'fontsize':9}
words = ['Hi','Goodbye','What''s this','Aloha','So long, farewell']
for i in range(0,len(x)):
tx = x[i]
ty = y[i]
word = words[i]
text(tx,ty,word,fontdict2,bbox={'facecolor':'w'})

savefig('textplot.eps')
savefig('textplot.png')
close(fig)

-- 
--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plot_date and legend

2008-05-01 Thread Michael Hearne
I'm noticing strange behavior with the legend function when used in  
combination with matplotlib. If I do the following:

import datetime
from pylab import *
date1 = datetime.date( 1952, 1, 1 )
date2 = datetime.date( 2004, 4, 12 )
delta = datetime.timedelta(days=100)
dates = drange(date1, date2, delta)
s1 = rand(len(dates))
plot_date(dates, s1,'r.')
hold(True)
s2 = rand(len(dates))
plot_date(dates, s2,'bo')
legend(('s1','s2'))

The resulting legend shows the symbols twice (two little red dots and  
two blue ones).  Does anyone else get this, and if so, do you know  
what the problem is?

--Mike



--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--



-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot_date and legend

2008-05-01 Thread Michael Hearne
Contents of matplotlib.__version__
'0.98pre'

My Matplotlib is from the SciPy SuperPack for Mac OS X  from 
http://macinscience.org/?page_id=6
On May 1, 2008, at 3:32 PM, Michael Hearne wrote:

 I'm noticing strange behavior with the legend function when used in  
 combination with matplotlib. If I do the following:

 import datetime
 from pylab import *
 date1 = datetime.date( 1952, 1, 1 )
 date2 = datetime.date( 2004, 4, 12 )
 delta = datetime.timedelta(days=100)
 dates = drange(date1, date2, delta)
 s1 = rand(len(dates))
 plot_date(dates, s1,'r.')
 hold(True)
 s2 = rand(len(dates))
 plot_date(dates, s2,'bo')
 legend(('s1','s2'))

 The resulting legend shows the symbols twice (two little red dots  
 and two blue ones).  Does anyone else get this, and if so, do you  
 know what the problem is?

 --Mike



 --
 Michael Hearne
 [EMAIL PROTECTED]
 (303) 273-8620
 USGS National Earthquake Information Center
 1711 Illinois St. Golden CO 80401
 Senior Software Engineer
 Synergetics, Inc.
 --






--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--



-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Installing matplotlib

2008-05-01 Thread Michael Hearne
Jeff (or anyone) - I recently reinstalled all of my numpy/scipy  
related packages, including matplotlib, from a Mac OS X installer  
called the SciPy SuperPack.

(http://macinscience.org/?page_id=6)

All of the packages he includes work really well.

However, after I used easy_install to grab Basemap, I found I can't  
import it.  I was wondering if you could give me a pointer on how to  
tell Python where to look for Basemap?

Thanks,

Mike Hearne

My site-packages directory looks like this:
-rw-rw-r--   1 root  admin 119 Oct  5  2007 README
drwxr-xr-x  20 root  admin 680 Apr 30 16:43 basemap-0.9.9.1-py2.5- 
macosx-10.5-i386.egg
-rw-r--r--   1 root  admin 555 Apr 30 16:43 easy-install.pth
drwxr-xr-x   4 root  admin 136 Apr 30 16:49  
ipython-0.8.3.svn.r3001-py2.5.egg
drwxr-xr-x  12 root  admin 408 Apr 30 16:48 matplotlib-0.98pre- 
py2.5-macosx-10.3-i386.egg
drwxr-xr-x  11 root  admin 374 Apr 17 15:03 matplotlib-0.98pre- 
py2.5-macosx-10.5-i386.egg
drwxr-xr-x   5 root  admin 170 Apr 30 16:38 nose-0.10.1-py2.5.egg
drwxr-xr-x   4 root  admin 136 Apr 17 15:03 numpy-1.0.5.dev4954- 
py2.5-macosx-10.5-i386.egg
drwxr-xr-x   4 root  admin 136 Apr 30 16:48 numpy-1.1.0.dev5077- 
py2.5-macosx-10.3-i386.egg
drwxr-xr-x   4 root  admin 136 Apr 17 15:04 pymc-2.0DEV_r686-py2.5- 
macosx-10.3-i386.egg
drwxr-xr-x   4 root  admin 136 Apr 30 16:49 pymc-2.0DEV_r709-py2.5- 
macosx-10.3-i386.egg
drwxr-xr-x   6 root  admin 204 Apr 17 15:04 readline-2.5.1-py2.5- 
macosx-10.5-i386.egg
drwxr-xr-x   4 root  admin 136 Apr 17 15:04 scipy-0.7.0.dev4075- 
py2.5-macosx-10.5-i386.egg
drwxr-xr-x   4 root  admin 136 Apr 30 16:48 scipy-0.7.0.dev4174- 
py2.5-macosx-10.3-i386.egg
-rw-r--r--   1 root  admin  324858 Apr 17 15:03 setuptools-0.6c8- 
py2.5.egg
-rw-r--r--   1 root  admin  29 Apr 30 16:41 setuptools.pth

The easy-install.pth file looks like this:
import sys; sys.__plen = len(sys.path)
./setuptools-0.6c8-py2.5.egg
./readline-2.5.1-py2.5-macosx-10.5-i386.egg
./ipython-0.8.3.svn.r3001-py2.5.egg
./numpy-1.1.0.dev5077-py2.5-macosx-10.3-i386.egg
./matplotlib-0.98pre-py2.5-macosx-10.3-i386.egg
./scipy-0.7.0.dev4174-py2.5-macosx-10.3-i386.egg
./pymc-2.0DEV_r709-py2.5-macosx-10.3-i386.egg
./nose-0.10.1-py2.5.egg
./basemap-0.9.9.1-py2.5-macosx-10.5-i386.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:];  
p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p 
+len(new)



-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] problems installing matplotlib on RHEL5 with easy_install

2008-04-23 Thread Michael Hearne
I'm experimenting with installing a full python/numpy/scipy/matplotlib  
etc. suite on a RedHat Enterprise 5 system, and trying to document  
what would be the simplest procedure to accomplish each step.

I managed to install numpy using easy_install, but when I tried to  
install matplotlib using the same tool, I get the following errors:

error: Setup script exited with error: Command gcc -pthread -fno- 
strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes - 
fPIC -I/usr/local/include -I/usr/include -I. -I/usr/local/include/ 
freetype2 -I/usr/include/freetype2 -I./freetype2 -I/usr/local/include/ 
python2.5 -c src/ft2font.cpp -o build/temp.linux-x86_64-2.5/src/ 
ft2font.o failed with exit status 1
Exception exceptions.OSError: (2, 'No such file or directory', 'src/ 
image.cpp') in bound method CleanUpFile.__del__ of  
setupext.CleanUpFile instance at 0x1150f710 ignored
Exception exceptions.OSError: (2, 'No such file or directory', 'src/ 
transforms.cpp') in bound method CleanUpFile.__del__ of  
setupext.CleanUpFile instance at 0x11510950 ignored
Exception exceptions.OSError: (2, 'No such file or directory', 'src/ 
backend_agg.cpp') in bound method CleanUpFile.__del__ of  
setupext.CleanUpFile instance at 0x1150f3f8 ignored

Any tips?  Do I need to install some sort of back-end infrastructure  
first?

I'll be happy to provide more detailed error messages, or do some  
basic tests.

Thanks,

Mike


--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--



-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to close the figure after show it?

2008-03-20 Thread Michael Hearne

I think f = figure();
...
pylab.close(f);

should work.

--Mike
On Mar 20, 2008, at 2:14 PM, Fans Gnu wrote:


Hi All,

I am using matplotlab to plot some figure. I would like to close  
the figure after show it 5 sec. My code is pasted below. However, I  
can not close the figure automatically.  Can anyone help me to fix it?


Thanks,
Brook

==
import time
from pylab import *
from matplotlib import *
x=**
y=**
x2=**
y2=***
figure()
hold(True)
plot(x,y)
plot(x2,y2,'g^')
axis([0, 100, 0, 100])
title('Pylab plot')
xlabel('X')
ylabel('Y')
grid()
pylab.show()
time.sleep(5)
pylab.close()


Looking for last minute shopping deals? Find them fast with Yahoo!  
Search.
-- 
---

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





--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
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] fill() function

2008-03-13 Thread Michael Hearne
I realize I was probably too wordy the first time I posted this:

Does anyone know how to specify arbitrary colors to the fill() function?

None of the following methods I tried seemed to work:
ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array 
([0.75,0.75,0.25,0.25,0.75]),'#FF')
ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array 
([0.75,0.75,0.25,0.25,0.75]),color='#FF')
ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array 
([0.75,0.75,0.25,0.25,0.75]),color=(1,0,0))

Thanks,

Mike Hearne


--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--



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

2008-03-12 Thread Michael Hearne
I'm trying to understand the usage of Colormaps, and  
LinearSegmentedColormaps in particular.


I can create segmentdata that looks like the example at the bottom of  
this message.  Each color has a 3x9 list of values.


I can then construct a LinearSegmentedColormap as follows:
palette = LinearSegmentedColormap('my_colormap',cdict)

the 'N' attribute of my palette object reports that the length of the  
colormap is 256.  However, when I try to retrieve the color tuple for  
any value above 50, I get black:


palette(51) = (0.0, 0.0, 0.0, 1.0)

Why aren't there 256 different colors in my colormap?

--Mike

cdict = {'blue': [[0.0, 1.0, 1.0],
  [9.9974738e-05, 0.749019622803, 0.749019622803],
  [0.001000475, 0.623529434204, 0.623529434204],
  [0.0020009499, 0.498039215803, 0.498039215803],
  [0.0099977648, 0.372549027205, 0.372549027205],
  [0.01999553, 0.247058823705, 0.247058823705],
  [0.1000149, 0.121568627656, 0.121568627656],
  [0.2000298, 0.0, 0.0],
  [1.0, 0.0, 0.0]],
 'green': [[0.0, 1.0, 1.0],
   [9.9974738e-05, 0.749019622803, 0.749019622803],
   [0.001000475, 0.623529434204, 0.623529434204],
   [0.0020009499, 0.498039215803, 0.498039215803],
   [0.0099977648, 0.372549027205, 0.372549027205],
   [0.01999553, 0.247058823705, 0.247058823705],
   [0.1000149, 0.121568627656, 0.121568627656],
   [0.2000298, 0.0, 0.0],
   [1.0, 0.0, 0.0]],
 'red': [[0.0, 1.0, 1.0],
 [9.9974738e-05, 0.749019622803, 0.749019622803],
 [0.001000475, 0.623529434204, 0.623529434204],
 [0.0020009499, 0.498039215803, 0.498039215803],
 [0.0099977648, 0.372549027205, 0.372549027205],
 [0.01999553, 0.247058823705, 0.247058823705],
 [0.1000149, 0.121568627656, 0.121568627656],
 [0.2000298, 0.0, 0.0],
 [1.0, 0.0, 0.0]]}





--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
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


Re: [Matplotlib-users] basemap scalebar

2008-03-04 Thread Michael Hearne
Jeff - I think the way GMT does it would be okay - they have a  
latitude of true scale, which I usually choose as the center latitude  
of the map.


I was thinking we should allow people to choose the simple or  
fancy options.  Do you think it will be okay to have the height of  
the bar and the text offset be relative to the length of it?  I  
suppose if the height becomes a problem, people could use the yoffset  
keyword...


--Mike
On Mar 4, 2008, at 6:05 AM, Jeff Whitaker wrote:


Michael Hearne wrote:
Jeff - That would replicate the simple scale-bar from GMT.   
Below is my not-complete attempt at replicating the fancy scale  
bar.  It would need some options for specifying different units  
(miles, nautical miles, etc.) and perhaps some more attention to  
spacing of the text from the scale bar and tick marks...


--Mike


Mike:  Very nice!  Do you want the scale to show the true distance  
on the earth (in which case the labels will vary depending on where  
the label is placed), or the distance in map projection coordinates  
(in which case the labels are constant)?  Or perhaps a lat/lon  
value could be given to specify where the scale is true?


-Jeff


from numpy import *
from matplotlib.toolkits.basemap import Basemap, pyproj
from pylab import *
# add drawscale method to Basemap class.
class Basemap2(Basemap):
   def drawscale(self,lon,lat,length,yoffset=None):
   draw a fancy map scale from lon-length/2,lat-yoffset to
   lon-length/2,lat-yoffset, label it with actual distance in  
km

   length = length*1000 #input length is km

   #we need 5 sets of x coordinates (in map units)
   #center of scale
   xc,yc = self(lon,lat)
   #left edge of scale
   lon1,lat1 = self(xc-length/2,yc,inverse=True)
   x1,y1 = self(lon1,lat1)
   #quarter scale
   lon2,lat2 = self(xc-length/4,yc,inverse=True)
   x2,y2 = self(lon2,lat2)
   #three quarter scale
   lon3,lat3 = self(xc+length/4,yc,inverse=True)
   x3,y3 = self(lon3,lat3)
   #right edge of scale
   lon4,lat4 = self(xc+length/2,yc,inverse=True)
   x4,y4 = self(lon4,lat4)
  if yoffset is None: yoffset = 0.1*length

   #plot top line
   ytop = yc+yoffset/2
   ybottom = yc-yoffset/2
   ytick = ybottom - yoffset/2
   ytext = ytick - yoffset/2
   m.plot([x1,x4],[ytop,ytop],color='k')
   #plot bottom line
   m.plot([x1,x4],[ybottom,ybottom],color='k')
   #plot left edge
   m.plot([x1,x1],[ybottom,ytop],color='k')
   #plot right edge
   m.plot([x4,x4],[ybottom,ytop],color='k')

   #make a filled black box from left edge to 1/4 way across
   fill([x1,x2,x2,x1,x1],[ytop,ytop,ybottom,ybottom,ytop],'k')
   #make a filled white box from 1/4 way across to 1/2 way across
   fill([x2,xc,xc,x2,x2],[ytop,ytop,ybottom,ybottom,ytop],'w')
   #make a filled white box from 1/2 way across to 3/4 way across
   fill([xc,x3,x3,xc,xc],[ytop,ytop,ybottom,ybottom,ytop],'k')
   #make a filled white box from 3/4 way across to end
   fill([x3,x4,x4,x3,x3],[ytop,ytop,ybottom,ybottom,ytop],'w')
  #plot 3 tick marks at left edge, center, and right edge
   m.plot([x1,x1],[ytick,ybottom],color='k')
   m.plot([xc,xc],[ytick,ybottom],color='k')
   m.plot([x4,x4],[ytick,ybottom],color='k')

   #label 3 tick marks
   text(x1,ytext,'%d' % (0),\
   horizontalalignment='center',\
   verticalalignment='top',\
   fontsize=9)
   text(xc,ytext,'%d' % (round((length/2)/1000)),\
   horizontalalignment='center',\
   verticalalignment='top',\
   fontsize=9)
   text(x4,ytext,'%d' % (round((length)/1000)),\
   horizontalalignment='center',\
   verticalalignment='top',\
   fontsize=9)

   #put units on top
   text(xc,ytop+yoffset/2,'km',\
   horizontalalignment='center',\
   verticalalignment='bottom',\
   fontsize=9)

# setup of basemap ('lcc' = lambert conformal conic).
# use major and minor sphere radii from WGS84 ellipsoid.
m = Basemap2 
(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\

 rsphere=(6378137.00,6356752.3142),\
 resolution='l',area_thresh=1000.,projection='lcc',\
 lat_1=50.,lon_0=-107.)
# draw coastlines and political boundaries.
m.drawcoastlines()
m.fillcontinents()
# draw parallels and meridians.
# label on left, right and bottom of map.
m.drawparallels(arange(0.,80,20.),labels=[1,1,0,1])
m.drawmeridians(arange(10.,360.,30.),labels=[1,1,0,1])
# draw a line from x1,y to x2,y and label it with distance in km.
length = 3000 #kilometers
x1,y1 = 0.25*m.xmax, 0.25*m.ymax
lon1,lat1 = m(x1,y1,inverse=True)
m.drawscale(lon1,lat1,length)
title('a fancy map scale')
show()




--
Michael Hearne
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc

[Matplotlib-users] basemap scalebar

2008-03-03 Thread Michael Hearne
Does the capability exist in basemap to create a scale bar on the  
map?  If not, is this planned for the future?


For reference, see the -L option in GMT's psbasemap, pscoast, etc.

Thanks,






--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
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


Re: [Matplotlib-users] basemap scalebar

2008-03-03 Thread Michael Hearne
Jeff - That would replicate the simple scale-bar from GMT.  Below  
is my not-complete attempt at replicating the fancy scale bar.  It  
would need some options for specifying different units (miles,  
nautical miles, etc.) and perhaps some more attention to spacing of  
the text from the scale bar and tick marks...


--Mike

from numpy import *
from matplotlib.toolkits.basemap import Basemap, pyproj
from pylab import *
# add drawscale method to Basemap class.
class Basemap2(Basemap):
   def drawscale(self,lon,lat,length,yoffset=None):
   draw a fancy map scale from lon-length/2,lat-yoffset to
   lon-length/2,lat-yoffset, label it with actual distance in km
   length = length*1000 #input length is km

   #we need 5 sets of x coordinates (in map units)
   #center of scale
   xc,yc = self(lon,lat)
   #left edge of scale
   lon1,lat1 = self(xc-length/2,yc,inverse=True)
   x1,y1 = self(lon1,lat1)
   #quarter scale
   lon2,lat2 = self(xc-length/4,yc,inverse=True)
   x2,y2 = self(lon2,lat2)
   #three quarter scale
   lon3,lat3 = self(xc+length/4,yc,inverse=True)
   x3,y3 = self(lon3,lat3)
   #right edge of scale
   lon4,lat4 = self(xc+length/2,yc,inverse=True)
   x4,y4 = self(lon4,lat4)

   if yoffset is None: yoffset = 0.1*length

   #plot top line
   ytop = yc+yoffset/2
   ybottom = yc-yoffset/2
   ytick = ybottom - yoffset/2
   ytext = ytick - yoffset/2
   m.plot([x1,x4],[ytop,ytop],color='k')
   #plot bottom line
   m.plot([x1,x4],[ybottom,ybottom],color='k')
   #plot left edge
   m.plot([x1,x1],[ybottom,ytop],color='k')
   #plot right edge
   m.plot([x4,x4],[ybottom,ytop],color='k')

   #make a filled black box from left edge to 1/4 way across
   fill([x1,x2,x2,x1,x1],[ytop,ytop,ybottom,ybottom,ytop],'k')
   #make a filled white box from 1/4 way across to 1/2 way across
   fill([x2,xc,xc,x2,x2],[ytop,ytop,ybottom,ybottom,ytop],'w')
   #make a filled white box from 1/2 way across to 3/4 way across
   fill([xc,x3,x3,xc,xc],[ytop,ytop,ybottom,ybottom,ytop],'k')
   #make a filled white box from 3/4 way across to end
   fill([x3,x4,x4,x3,x3],[ytop,ytop,ybottom,ybottom,ytop],'w')

   #plot 3 tick marks at left edge, center, and right edge
   m.plot([x1,x1],[ytick,ybottom],color='k')
   m.plot([xc,xc],[ytick,ybottom],color='k')
   m.plot([x4,x4],[ytick,ybottom],color='k')

   #label 3 tick marks
   text(x1,ytext,'%d' % (0),\
horizontalalignment='center',\
verticalalignment='top',\
fontsize=9)
   text(xc,ytext,'%d' % (round((length/2)/1000)),\
horizontalalignment='center',\
verticalalignment='top',\
fontsize=9)
   text(x4,ytext,'%d' % (round((length)/1000)),\
horizontalalignment='center',\
verticalalignment='top',\
fontsize=9)

   #put units on top
   text(xc,ytop+yoffset/2,'km',\
horizontalalignment='center',\
verticalalignment='bottom',\
fontsize=9)

# setup of basemap ('lcc' = lambert conformal conic).
# use major and minor sphere radii from WGS84 ellipsoid.
m = Basemap2 
(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\

  rsphere=(6378137.00,6356752.3142),\
  resolution='l',area_thresh=1000.,projection='lcc',\
  lat_1=50.,lon_0=-107.)
# draw coastlines and political boundaries.
m.drawcoastlines()
m.fillcontinents()
# draw parallels and meridians.
# label on left, right and bottom of map.
m.drawparallels(arange(0.,80,20.),labels=[1,1,0,1])
m.drawmeridians(arange(10.,360.,30.),labels=[1,1,0,1])
# draw a line from x1,y to x2,y and label it with distance in km.
length = 3000 #kilometers
x1,y1 = 0.25*m.xmax, 0.25*m.ymax
lon1,lat1 = m(x1,y1,inverse=True)
m.drawscale(lon1,lat1,length)
title('a fancy map scale')
show()




--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
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


Re: [Matplotlib-users] preventing extra whitespace around figure

2008-02-29 Thread Michael Hearne
I gave this a shot, and eps2eps seems not to have any effect on the  
bounding box.  I've done some experiments where I reduce the bounding  
box by hand, which works really well - the only problem is I need a  
way to determine where the edge of my plot really is.


In Basemap, there is a box drawn around my map.  I'm pretty sure this  
is just the axis border, and I need to find a way to determine which  
of the many drawing commands in the postscript file represents this  
border.


Is there a way to set the color of this plot box in matplotlib, so  
that I can use that as a clue in the postscript?


Thanks,

Mike
On Feb 29, 2008, at 4:38 AM, Alan G Isaac wrote:


I think I recall that eps2eps can reset your bounding box,
if that's the problem.
http://www.linuxcommand.org/man_pages/eps2eps1.html

Cheers,
Alan Isaac




-- 
---

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





--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
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] preventing extra whitespace around figure

2008-02-28 Thread Michael Hearne
Does anyone know of a way of preventing the generation of extra  
whitespace around the edge of a figure?  The code sample below  
demonstrates the problem I'm having - I've tried postprocessing the  
postscript output with ImageMagick's mogrify -trim, but  
unfortunately it makes it into a raster image in the process, and I  
really need the output to stay in vector postscript.


---
#!/usr/bin/python
from matplotlib.toolkits.basemap import Basemap
from pylab import *

clat = 21.813100
clon = 120.529800
xmin=117.629800
ymin=19.079100
xmax=123.546467
ymax=24.579100

bounds = [xmin,xmax,ymin,ymax]

figwidth = 5.4
dx = bounds[1] - bounds[0]
dy = bounds[3] - bounds[2]
clat = bounds[2] + (bounds[3] - bounds[2])/2
clon = bounds[0] + (bounds[1] - bounds[0])/2
aspect = dy/dx
figheight = aspect * figwidth
fig = figure(figsize=(figwidth,figheight))
ax1 = fig.add_axes([0,0,0.98,0.98])

m = Basemap(llcrnrlon=xmin,llcrnrlat=ymin,urcrnrlon=xmax,urcrnrlat=ymax,
rsphere=(6378137.00,6356752.3142),
resolution='h',projection='merc',
lat_ts=clat)

water_color = [.47,.60,.81]
m.drawrivers(color=water_color)
m.drawcoastlines(linewidth=0.1)

#draw inset map
ax2 = fig.add_axes((0.1,0.1,0.25,0.25))
map = Basemap(resolution='l',
  projection='ortho',
  lon_0=clon,lat_0=clat,ax=ax2)
print 'map created.'
map.drawcountries(linewidth=0.1,color=[0.2,0.2,0.2])
map.drawcoastlines(linewidth=0.05,color=[0.2,0.2,0.2])
map.drawlsmask((230,230,230,255),(119,155,207,255))
meridians = arange(-180,210,30)
parallels = arange(-90,120,30)
map.drawmeridians(meridians,linewidth=0.1,dashes=[1,0],color= 
[0.2,0.2,0.2])
map.drawparallels(parallels,linewidth=0.1,dashes=[1,0],color= 
[0.2,0.2,0.2])

pcx,pcy = map(clon,clat)
print 'Lat: %f, Lon: %f' % (clat,clon)
map.plot(array([pcx]),array([pcy]),'rD',linewidth=2,markersize=5)
map.drawmapboundary(color='k',linewidth=2.0)

savefig('maptest.eps')
close('all')
---



--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
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] Preventing overlapping text on axes

2008-02-27 Thread Michael Hearne
All:  I'm using the text() function to place city labels on a map  
with Basemap.  However, many of these cities are so close together  
that the labels overlap when they're placed on the map.

Is there some way to determine the bounding box for a given text  
object _before_ placing it on the map, so that I can write an  
algorithm to detect overlaps?

Alternately, if someone else has some clever way of placing non- 
conflicting labels on maps, I'd love to hear about it!

Thanks,

Mike 

-
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] transparent background for encapsulated postscript output

2007-12-14 Thread Michael Hearne

I am using Basemap, and trying to create two maps:

One large-scale map, and a small-scale inset map of the world  
centered on the location of the large-scale map.  My ultimate goal is  
to create a figure where the inset map is inserted into a corner of  
the large-scale map.  I can see two ways of doing this:


1) Create both as encapsulated postscript images separately, and put  
them together in a later compositing process. (I'm doing this  
already).
2) Create both as basemap instances, and then draw the smaller one on  
top of the large-scale one.  I have no idea how to do this.


A problem I have encountered with the first method is that my image  
background is set to white by default.  I've tried to make it  
transparent by doing the following:


fig = figure(figsize=(5,5),frameon=False) #turn the frame off completely
fig.figurePatch.set_alpha(0.0) #tried setting this to 1.0 and 0.0,  
neither works


Method #2 would be cleaner, if I could do what I wanted to do in  
terms of transparencies, but if not, I'll take method #1.


Does anyone know if it is possible to set the image background  
transparent for encapsulated postscript output?


Thanks,

Mike




--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] transparent background for encapsulated postscript output

2007-12-14 Thread Michael Hearne

Jeff - Yes, that's what I want, thanks.

I think more explanation is in order - my large-scale map is the  
default basemap projection.  The inset map of the globe is a  
orthogonal projection, which means it comes out as a little circle.   
I want to insert this smaller map into the larger one, without having  
to see the area around the circle.


I'm having trouble explaining this... here's an example:
http://earthquake.usgs.gov/eqcenter/pager/us/2007kwau/us/1/onePAGER.pdf

I want to replicate the little inset globe on the map with the contours.

--Mike

On Dec 14, 2007, at 12:49 PM, Jeff Whitaker wrote:


Michael Hearne wrote:
Jeff - Darn it.  So is there a way to embed an axis _inside_  
another, possibly with a transparent background?


--Mike



Mike:  Not quite sure why you need to have it transparent - you  
definitely can't have that with postscript, but it should be  
possible with the other backends (png, pdf or svg).  There's an  
example of embedded axes at http://matplotlib.sourceforge.net/ 
screenshots.html (axes_demo.py).  The inset axes is just drawn on  
top of the primary axes in the same figure. Is that what you want?


-Jeff


On Dec 14, 2007, at 12:28 PM, Jeff Whitaker wrote:


Michael Hearne wrote:

I am using Basemap, and trying to create two maps:

One large-scale map, and a small-scale inset map of the world  
centered on the location of the large-scale map.  My ultimate  
goal is to create a figure where the inset map is inserted into  
a corner of the large-scale map.  I can see two ways of doing this:


1) Create both as encapsulated postscript images separately, and  
put them together in a later compositing process. (I'm doing  
this already).
2) Create both as basemap instances, and then draw the smaller  
one on top of the large-scale one.  I have no idea how to do this.


A problem I have encountered with the first method is that my  
image background is set to white by default.  I've tried to make  
it transparent by doing the following:


fig = figure(figsize=(5,5),frameon=False) #turn the frame off  
completely
fig.figurePatch.set_alpha(0.0) #tried setting this to 1.0 and  
0.0, neither works


Method #2 would be cleaner, if I could do what I wanted to do in  
terms of transparencies, but if not, I'll take method #1.


Does anyone know if it is possible to set the image background  
transparent for encapsulated postscript output?


Thanks,

Mike


Mike:  Postscript doesn't support alpha transparency.  It might  
work with PDF though.


-Jeff

--
Jeffrey S. Whitaker Phone  : (303)497-6313
Meteorologist   FAX: (303)497-6449
NOAA/OAR/PSD  R/PSD1Email  : [EMAIL PROTECTED]  
mailto:[EMAIL PROTECTED]

325 BroadwayOffice : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg





--
Michael Hearne
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--





--
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-124
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg





--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] transparent background for encapsulated postscript output

2007-12-14 Thread Michael Hearne

Jeff - Yes!  I'm working on implementing this now for my app...

FYI, I got the following error:
TypeError: drawmapboundary() got an unexpected keyword argument  
'fill_color'



and again for 'lake_color' on the fillcontinents() method.

I'm using 0.9.7, which I think is the latest released version...

--Mike
On Dec 14, 2007, at 1:31 PM, Jeff Whitaker wrote:


from matplotlib.toolkits.basemap import Basemap
import pylab
fig = pylab.figure()
ax1 = fig.add_axes([0.1,0.1,0.8,0.8])
m = Basemap(ax=ax1)
m.drawcoastlines(linewidth=0.5)
m.fillcontinents()
ax2 = fig.add_axes([0.1,0.425,0.15,0.15])
m2 = Basemap(projection='ortho',lon_0=-105,lat_0=40,ax=ax2)
m2.drawmapboundary(fill_color='aqua')
m2.drawcoastlines(linewidth=0.1)
m2.fillcontinents(color='coral',lake_color='aqua')
pylab.show()





--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] labeling contours with roman numerals

2007-12-14 Thread Michael Hearne
I've seen this, but I'm not clever enough to see how to extend that  
to multiple levels - after all, I don't want to label every line with  
the same string...


--Mike
On Dec 14, 2007, at 3:20 PM, Mark Bakker wrote:


Michael -
This trick for replacing contour labels with a string was posted a  
little while back (by someone else):

class FormatFaker(object):
   def __init__(self, str): self.str = str
   def __mod__(self, stuff): return self.str

A=arange(100).reshape(10,10)
CS=contour(A,[50,])
CS.clabel(fmt=FormatFaker('Some String'))



From: Michael Hearne [EMAIL PROTECTED] 
Subject: [Matplotlib-users] labeling contours with roman numerals
To: Matplotlib Users matplotlib-users@lists.sourceforge.net
Message-ID:  [EMAIL PROTECTED]
Content-Type: text/plain; charset=us-ascii

Does a LineCollection generated by contour() have a property that
holds the labels?  I would like to label my contour lines with roman
numerals, and cannot figure out how to get clabel to do that.

Thanks,

Mike








--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] labeling contours with roman numerals

2007-12-13 Thread Michael Hearne
Does a LineCollection generated by contour() have a property that  
holds the labels?  I would like to label my contour lines with roman  
numerals, and cannot figure out how to get clabel to do that.


Thanks,

Mike




--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] setting figure extent to only include extent of Axes

2007-12-12 Thread Michael Hearne
All:  I have an issue I'm hoping someone here can help with.  I've  
created a encapsulated postscript figure from pylab (basemap,  
actually, but it shouldn't make a difference), and I'd like to have  
the entire saved image be the extent of the axes, with no border  
whatsoever.  Is there a way to set the extent of either the axes or  
the figure so that this is so?


And before someone points this out to me - yes, I realize that there  
are other tools (ImageMagick, for example) I could use to trim the  
whitespace around the edge of the image, but this is part of an  
automated system and I'd prefer not to have to bomb out to a shell  
for something like that.


Thanks,

Mike




--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] converting GMT color palettes to pylab colormaps

2007-12-05 Thread Michael Hearne
Does anyone here have any experience converting GMT color palettes  
into pylab colormaps?  I took a stab at it, and the results are not  
really what I expected.


GMT, for the unfamiliar, is a scientific plotting/mapping package  
that I'm doing my best to rid myself of.  If you've never heard of  
it, then you can probably ignore this message.


Here's my attempt at bringing in a GMT color palette:

#!/usr/bin/python

from pylab import *

#GMT color palette - Colors are specified by a RGB triplet with each  
value in the range
#0-255.  The palette below specifies that a data value between 1 and  
2 will be assigned a color
#linearly interpreted between the colors (255,255,255) and  
(191,204,255).


# 0   255 255 255 1   255 255 255
# 1   255 255 255 2   191 204 255
# 2   191 204 255 3   160 230 255
# 3   160 230 255 4   128 255 255
# 4   128 255 255 5   122 255 147
# 5   122 255 147 6   255 255 0
# 6   255 255 0   7   255 200 0
# 7   255 200 0   8   255 145 0
# 8   255 145 0   9   255 0   0
# 9   255 0   0   10  200 0   0
# 10  200 0   0   13  128 0   0

cdict = {'red': ((0.0,1.00,1.0),
 (0.1,1.00,0.75),
 (0.2,0.75,0.63),
 (0.3,0.63,0.50),
 (0.4,0.50,0.48),
 (0.5,0.48,1.00),
 (0.6,1.00,1.00),
 (0.7,1.00,1.00),
 (0.8,1.00,1.00),
 (0.9,1.00,0.78),
 (1.0,0.78,0.50)),
 'green': ((0.0,1.00,1.00),
   (0.1,1.00,0.80),
   (0.2,0.80,0.90),
   (0.3,0.90,1.00),
   (0.4,1.00,1.00),
   (0.5,1.00,1.00),
   (0.6,1.00,0.78),
   (0.7,0.78,0.57),
   (0.8,0.57,0.00),
   (0.9,0.00,0.00),
   (1.0,0.00,0.00)),
 'blue': ((0.0,1.00,1.00),
  (0.1,1.00,1.00),
  (0.2,1.00,1.00),
  (0.3,1.00,1.00),
  (0.4,1.00,0.58),
  (0.5,0.58,0.00),
  (0.6,0.00,0.00),
  (0.7,0.00,0.00),
  (0.8,0.00,0.00),
  (0.9,0.00,0.00),
  (1.0,0.00,0.00))}

my_cmap = matplotlib.colors.LinearSegmentedColormap('my_colormap',cdict)
pcolor(rand(10,10),cmap=my_cmap)
colorbar()
savefig('colormap.png')





--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap questions

2007-11-02 Thread Michael Hearne
Pierre - That's great.  As soon as I get the zorder problem figured  
out (can't have land AND ocean masks on!) , I'll give your solution a  
try.


One question regarding - I found this page:
http://trac.osgeo.org/gdal/wiki/GdalOgrInPython

but it wasn't immediately apparent how to _get_ it.  Do I have to  
download/build ogr first, then install the python bindings?


--Mike
On Nov 2, 2007, at 10:06 AM, Pierre GM wrote:


On Friday 02 November 2007 11:51:55 Michael Hearne wrote:

2) Has anyone figured out a way to make an _ocean_ mask?  I need my
map to look like this


Assuming that you have gdal installed, you can use this set of  
functions.
Basically, you use OGR to compute the differences between the  
background and
the land polygons... Works fine for my applications (I interpolate  
some
rainfall fields over AL/GA/FL, and need to hide the interpolated  
values in
the Gulf of Mexico), but might still be a tad buggy. Please don't  
hesittate

to contact me if you need help with that.



#- 
-

# --- OGR conversion ---
#- 
-

import ogr

def polygon_to_geometry(polygon):
Creates a new ogr.Geometry object from a matplolib.Polygon.
if not isinstance(polygon, Polygon):
raise TypeError, The input data should be a valid Polygon  
object!

listvert = [%s %s % (x,y)  for (x,y) in polygon.get_verts()]
listvert.append(listvert[0])
return ogr.CreateGeometryFromWkt(POLYGON ((%s)) % ','.join 
(listvert))


#- 


# OGR to matplotlib ---
#- 



def _geometry_to_vertices(geometry):
Creates a list of vertices (x,y) from the current geometry.
verts = []
for nl in range(geometry.GetGeometryCount()):
line = geometry.GetGeometryRef(nl)
points = [(line.GetX(i), line.GetY(i)) for i in
range(line.GetPointCount())]
verts.append(points)
return verts


def geometry_to_vertices(geometry):
Creates lists of vertices (x,y) from the current geometry.
if not isinstance(geometry, ogr.Geometry):
raise TypeError, The input data should be a valid  
ogr.Geometry

object!
vertices = []
#
if geometry.GetGeometryType() == ogr.wkbPolygon:
vertices.extend(_geometry_to_vertices(geometry))
elif geometry.GetGeometryType() == ogr.wkbMultiPolygon:
for np in range(geometry.GetGeometryCount()):
poly = geometry.GetGeometryRef(np)
vertices.extend(_geometry_to_vertices(poly))
return vertices

#- 
-

# --- Add-ons
#- 
-


def fillwaterbodies(basemap, color='blue', inlands=True, ax=None,
zorder=None):
Fills the water bodies with color.
If inlands is True, inland water bodies are also filled.

:Inputs:
basemap : Basemap
The basemap on which to fill.
color : string/RGBA tuple *['blue']*
Filling color
inlands : boolean *[True]*
Whether inland water bodies should be filled.
ax : Axes instance *[None]*
Axe on which to plot. If None, the current axe is selected.
zorder : integer *[None]*
zorder of the water bodies polygons.

if not isinstance(basemap, Basemap):
raise TypeError, The input basemap should be a valid  
Basemap object!

#
if ax is None and basemap.ax is None:
try:
ax = pylab.gca()
except:
import pylab
ax = pylab.gca()
#
coastpolygons = basemap.coastpolygons
coastpolygontypes = basemap.coastpolygontypes
(llx, lly) = (basemap.llcrnrx, basemap.llcrnry)
(urx, ury) = (basemap.urcrnrx,basemap.urcrnry)
background = Polygon([(llx, lly), (urx, lly), (urx, ury), (llx,  
ury)])

#
ogr_background = polygon_to_geometry(background)
inland_polygons = []
#
for (poly, polytype) in zip(coastpolygons, coastpolygontypes):
if polytype != 2:
verts = [%s %s % (x,y) for (x,y) in zip(*poly)]
ogr_poly = ogr.CreateGeometryFromWkt(POLYGON
((%s)) % ','.join(verts))
ogr_background = ogr_background.Difference(ogr_poly)
else:
inland_polygons.append(Polygon(zip(*poly),
   facecolor=color,
   edgecolor=color,
   linewidth=0))
#
background = geometry_to_vertices(ogr_background)
for xy in background:
patch = Polygon(xy, facecolor=color, edgecolor=color,  
linewidth=0)

if zorder is not None:
patch.set_zorder(zorder)
ax.add_patch(patch)
#
if inlands

Re: [Matplotlib-users] Basemap questions

2007-11-02 Thread Michael Hearne
Jeff - I looked at that example file, and I think there's a big  
difference - your etopo base data set is global, and you can plot  
over the data in the oceans by setting the mask on all pixels less  
than zero.


My dataset (a map of earthquake shaking) is not global, and actually  
has NO missing data.   I think I need a way to clip the data by the  
land mask - that is, find all of the pixels that are NOT on land, and  
then mask them off.


Is there an easy way to do this with matplotlib/basemap tools?

Regarding my other issue - I used my script to test x/y offset  
values: [0.05,0.1,0.5,1.0,10] and couldn't see any difference.  I'd  
be more than happy to provide test output, or debugging information...


Just to be clear - these offsets are supposed to move the meridian  
and/or parallel labels around with respect to the map edge?  My  
actual goal is to get the labels inside the edge of the map (I tried  
negative numbers to accomplish this, to no effect.)


On a positive note, I _can_ make solid lines!

Thanks for all of your help,

Mike


On Nov 2, 2007, at 11:47 AM, Jeff Whitaker wrote:


Michael Hearne wrote:

I have two questions:

1)  The fillcontinents() method has a zorder keyword parameter.   
Is this supposed to work with imshow()?  I have the latest tarball  
from the website, and I can't get my image to paint on top of the  
continents.


2) Has anyone figured out a way to make an _ocean_ mask?  I need  
my map to look like this
( http://earthquake.usgs.gov/eqcenter/pager/us/2007itah/us/5/ 
shakemap.600.jpg)


, where the image data (the yellow and orange bits) that extends  
out beyond the land boundary is masked by a blue ocean.


Thanks,

Mike
Mike:  You can set the background color for the axes instance to  
blue, and then draw the filled continents over it.


You'll also have to make your image a masked array, and set the  
missing values to be transparent.


The basemap examples plotmap_masked.py shows how to do both of  
these things.


-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-124
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg





--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap questions

2007-11-02 Thread Michael Hearne

Jeff -

My data set is actually dynamically generated by a program called  
ShakeMap.  It's a 2D grid, with an extent usually about 600  
kilometers on a side, centered wherever the earthquake happened to  
be.  The ShakeMap program does not know or care that some of the data  
may be under water, but for display purposed, I do!  The grid is also  
in a geographic projection (latitude/longitude coordinates assumed to  
be cartesian).


So in this test instance (on a data set near Taiwan), my map width is  
about 5.91 degrees longitude, and my height is about 5.5 degrees  
latitude.


If I set xoffset=-0.01*5.91, I get -0.05.  This is not noticeably  
different than the default.


Is the problem that my dataset is not projected?

--Mike
On Nov 2, 2007, at 1:33 PM, Jeff Whitaker wrote:


Michael Hearne wrote:
Jeff - I looked at that example file, and I think there's a big  
difference - your etopo base data set is global, and you can plot  
over the data in the oceans by setting the mask on all pixels less  
than zero.


My dataset (a map of earthquake shaking) is not global, and  
actually has NO missing data.   I think I need a way to clip the  
data by the land mask - that is, find all of the pixels that are  
NOT on land, and then mask them off.

Mike:

If it's not global, is it just defined for land points?  If so, it  
can't be a 2-D grid, so you won't be able to plot it with imshow  
anyway.  Can you explain the structure of the data?


Is there an easy way to do this with matplotlib/basemap tools?
Not really.  You'll have to define a sea mask for your grid and use  
that the create a masked array.  There is a land-sea mask dataset  
included in basemap, but it may not match the resolution of your grid.




Regarding my other issue - I used my script to test x/y offset  
values: [0.05,0.1,0.5,1.0,10] and couldn't see any difference.   
I'd be more than happy to provide test output, or debugging  
information...


Just to be clear - these offsets are supposed to move the meridian  
and/or parallel labels around with respect to the map edge?  My  
actual goal is to get the labels inside the edge of the map (I  
tried negative numbers to accomplish this, to no effect.)
You  need to define an offset as a fraction of the map width - the  
numbers you are giving are too small to notice any difference.  As  
I said before, try something like -0.01*(m.max-m.min).


On a positive note, I _can_ make solid lines!


Good!

-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-124
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg





--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users