[ncl-talk] Manually set colors for station datapoints (markers) over a map

Guido Cioni guidocioni at gmail.com
Thu Aug 18 01:28:45 MDT 2016


Hey Tabish, can you be more specific? 
I achieved something similar a few days ago: I wanted to put some markers on a  contour plot and to match the color scale in order to have a visual estimation of uncertainty. I think the only way to go is to put the marker command into a loop so that every color is computed when the marker is drawn. I’m attaching script and figure (sorry but had no time to clean the script). Notice that I’m also putting a border on the marker by drawing a larger black marker before.
 The relevant parts are:

 mres=True
 mres at gsMarkerIndex = 16
 mres at gsMarkerSizeF = 0.008
 mres2=True
 mres2 at gsMarkerIndex = 16
 mres2 at gsMarkerSizeF = mres at gsMarkerSizeF+0.0015
 mres2 at gsMarkerColor = "black"

 cmap = ResC at cnFillPalette
 cnLevels=ResC at cnLevels
 dims=dimsizes(rain_tot)
 marker=new(product(dimsizes(rain_tot)), graphic)
 marker_border=new(product(dimsizes(rain_tot)), graphic)
 plot=gsn_csm_contour(wks,rain_estC,ResC)

 k=0
 do i=0,dims(0)-1
  do j=0,dims(1)-1
    mres at gsMarkerColor=get_color_rgba(cmap, cnLevels, rain_tot(i,j))
    marker_border(k) = gsn_add_polymarker(wks,plot,lhflx(i,j),duration(i,j),mres2)
    marker(k) = gsn_add_polymarker(wks,plot,lhflx(i,j),duration(i,j),mres)
   k=k+1
   delete(mres at gsMarkerColor)
 end do
end do



Guido Cioni
http://guidocioni.altervista.org <http://guidocioni.altervista.org/> 

> On 17 Aug 2016, at 20:46, Tabish Ansari <tabishumaransari at gmail.com> wrote:
> 
> Hi
> 
> I've got some station data to plot over a map. The following example script looks like the nearest to what I want:
> http://www.ncl.ucar.edu/Applications/Scripts/station_2.ncl <http://www.ncl.ucar.edu/Applications/Scripts/station_2.ncl>
> 
> I'm actually able to plot my data by slightly modifying this script but have no control over the colors of the markers and legend. How can I set my own colors?
> 
> This is important because I want to match these colors with the colorscale of my model output (gridded data) contour plots.
> 
> Thanks
> 
> Tabish
> 
> Tabish U Ansari
> PhD student, Lancaster Environment Center
> Lancaster Univeristy
> Bailrigg, Lancaster, 
> LA1 4YW, United Kingdom
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160818/45a1d490/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: relationship.pdf
Type: application/pdf
Size: 104942 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160818/45a1d490/attachment.pdf 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160818/45a1d490/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_relationship.ncl
Type: application/octet-stream
Size: 11859 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160818/45a1d490/attachment.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160818/45a1d490/attachment-0002.html 


More information about the ncl-talk mailing list