Re: Colorize markers from gsn_polymarker() with colormap

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Feb 04 2013 - 14:56:47 MST

Dear Akio,

If you simply want each marker to have a different color, starting with say, color index 2 and ending with the last color in the color map, then you will need to draw the markers one at a time, changing gsMarkerColor each time. For example:

  cmap = gsn_retrieve_colormap(wks)
  clen = dimsizes(cmap(:,0)) ; Get number of colors
  do i=0,dimsizes(lon)-1
    gsres@gsMarkerColor = (i % (clen-2)) + 2
    gsn_polymarker(wks,map,lon(i),lat(i),gsres)
  end do

If you have more markers than you have colors, then you will either need to use a bigger color map, or else you can just start at color index 2 again, like the loop above does.

--Mary

On Feb 4, 2013, at 1:28 PM, akio.hansen wrote:

> Hi,
>
> sorry, I'm a total NCL newbie and I hope my question is not too stupid, but even after six hours of searching the NCL website, mailing list and Google, I couldn't find a good solution for my problem... I actually use the sample station data "pw.dat" from the NCL homepage with the ASCII format "ID LAT LON PW", which I want to plot on a world map. The example plot works quite well. But now my problem: I want to colorize these markers with a colormap and not with bins like it is shown in "station_2.ncl" on http://www.ncl.ucar.edu/Applications/station.shtml . Besides this, I try to get a colorbar at the bottom, which shows me the values of the different colors. All my plots show only one-colored markers, if I don't use the bin scheme from the NCL example. So, my question would be, is there any possibility to use a automatic color map and not define each bin manually ? I hope you understand, what I try to do?!? ;-)
> I attached my actual code to this mail.
>
> Thank you all very much!
> Akio
> <station_plot_marker.ncl>_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Feb 4 14:56:56 2013

This archive was generated by hypermail 2.1.8 : Wed Feb 06 2013 - 16:37:01 MST