Bruce,
From: br...@clearscienceinc.com
Date: Wed, 9 Feb 2011 09:51:06 -0500
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] Plotting multi-colored lines atop basemap instances
I am attempting to plot a line atop a basemap instance called "m". I can do
this without a problem with:
plot = m.plot(lon,lat,'r-') #lon and lat are lists
However, I'd like to color the line based on a third list called "intensity."
For instance, if the value of intensity between two points is 0-35 make it
green, 35-70 make it yellow, etc.
I have studied this example:
http://www.scipy.org/Cookbook/Matplotlib/MulticoloredLine but I cannot get a
collection added to the figure without errors.
You can always use 'regular' pyplot methods on your plot :
fig = plt.figure()
ax = fig.subplot(111)
m = Basemap(etc....)
convert your lon/lat to X,Y in the basemap projection:
X,Y = m(lon,lat)
then plot your line as if you were using only pyplot :
plt.plot(X,Y)
This way, you can add the collection as
ax.add_collection(somecollection)
HTH,
Thomas
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users