Hi,
Thanks for the suggestions. I also came the same conclusion about ordering
the arrays before hand. This did the trick for the zorder, but I also have
to make the marker unique for each data point. I need to keep everything
into one artist since I'm using a pick event to display the data represented
by that point. I'm not sure how I can use just 1 Artist, but get a variety
of distinct shapes (circles, squares, and triangles should be sufficient).
Thanks so much!
Aman
PS. Sorry about the duplicate emails Jeff. I forgot to hit "Reply to All"
the first time.
On Tue, Jun 29, 2010 at 3:39 PM, Jeff Whitaker <jsw...@fastmail.fm> wrote:
> On 6/29/10 1:19 PM, Thomas Lecocq wrote:
>
> Hi,
>
> What about ordering the arrays before plotting ? Are the first elements
> drawn back to front ?
>
> Thomas
>
> **********************
> Thomas Lecocq
> Geologist
> Ph.D.Student (Seismology)
> Royal Observatory of Belgium
> **********************
>
>
>
> ------------------------------
> Date: Mon, 28 Jun 2010 12:55:22 -0400
> From: athak...@weatherinnovations.com
> To: matplotlib-users@lists.sourceforge.net
> Subject: [Matplotlib-users] zorder for individual points in a scatter plot
> on a Basemap
>
> Hi,
>
> I'm currently using a scatter plot on a Basemap and I'd like to set the
> zorder of the individual points based on their temperature. The higher the
> temperature, the higher the zorder. Also, i'm using a colorbar to set the
> colors for the plot. Here is a snippet of my code:
>
> x = np.array(val)
> fig.sca(ax1)
> lon_0 =(urcrnrlon+llcrnrlon)/2
> lat_0 =(urcrnrlat+llcrnrlat)/2
> m =
> Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,urcrnrlon=urcrnrlon,
>
> urcrnrlat=urcrnrlat,resolution='i',projection='cyl',lon_0=lon_0,lat_0=lat_0)
> m.drawcoastlines()
> m.drawmapboundary()
> m.drawparallels(np.arange(llcrnrlat-1,urcrnrlat+1,5.))
> m.drawmeridians(np.arange(llcrnrlon-1,urcrnrlon+1,5.))
> m.fillcontinents(color='white',lake_color='aqua')
> m.drawcountries(linewidth=1)
> lons,lats = m(lon,lat)
>
> #I can do it this way, but this screws up the colorbar
> #for i in range(len(x)):
> #
> m.scatter(lons[i],lats[i],c=x[i],marker='o',picker=5,zorder=x[i])
>
> m.scatter(lons,lats,c=x,marker='o',picker=5)
> plt.title('Time Range: %s to %s'%(startDay.strftime("%b-%d
> %H:%M"),endDay.strftime("%b-%d %H:%M")))
> plt.colorbar(shrink=0.5)
>
> Is there anyway to set the zorder of the points without using the loop in
> commented code? Any help would be greatly appreciated.
>
> Thanks,
>
>
> Aman: You can save the mappable from the scatter you want the colorbar to
> represent, then pass that to colorbar. i.e.
>
> im = m.scatter(lons,lats,c=x,marker='o',picker=5) # plot all the pts, save
> mappable
> # now do one at a time
>
> for i in range(len(x)):
> m.scatter(lons[i],lats[i],c=x[i],marker='o',picker=5,zorder=x[i])
> plt.colorbar(im,shrink=0.5) # use mappable from 1st call to scatter for
> colorbar
>
> -Jeff
>
> --
> Jeffrey S. Whitaker Phone : (303)497-6313
> Meteorologist FAX : (303)497-6449
> NOAA/OAR/PSD R/PSD1 Email : jeffrey.s.whita...@noaa.gov
> 325 Broadway Office : Skaggs Research Cntr 1D-113
> Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Aman Thakral
B.Eng & Biosci, M.Eng Design
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users