[ncl-talk] How to define XY Labels manually (gsn_csm_contour_map)

Guido Cioni guidocioni at gmail.com
Wed May 17 01:45:53 MDT 2017


Hey Cunbo,
that's a problem that I faced many times and I haven't found a clean solution, yet. All the methods that I've used to manually define the labels have failed somehow. The "easy" solution that I'm using now is to define a new variable for your axis and then use that for plotting.

I believe you also have, like me, some coordinate informations in the x and y axis although the domain is idealized, that is defined only in terms of grid resolution, right? So what I've done was:

; 1 - defining the half-lenght of the two axis (in your case 10 km)
half_lenght_x=10.
half_lenght_y=10.

; 2 - manually compute the two axis as km
; using the longitude and latitude arrays from
; your input File

 dist_x:=(half_lenght_x/180.)*(File->lon)
 dist_x at units= "km"
 dist_x at long_name = "Distance"
 dist_x at standard_name = "distance"

 dist_y:=(half_lenght_y/90.)*(File->lat)
 dist_y at units= "km"
 dist_y at long_name = "Distance"
 dist_y at standard_name = "distance"

; 3 - use these two variables, which will have the same dimension as the coordinate variables, to plot
 ResC at sfXArray := dist_x
 ResC at sfYArray := dist_y 

Note that you will need to remove any reference to the old coordinate variables from the variable that you're plotting (so any attribute...).

Hope that helps

> On 17 May 2017, at 09:28, Cunbo HAN <hancbo at gmail.com> wrote:
> 
> Dear ncl-talk,
> 
> I am doing a contour plot with “gsn_csm_contour_map” and I want to setup XY labels manually. Like in the attached plot, how can I change the XBLabels “10w, 5w, 0, 5E, 10E” to “-10km, -5km, 0km, 5km, 10km “? Does anyone know how to modify this? Thanks very much!
> 
> Best,
> Cunbo
> 
> 
> <icon_shfx_50m_2d.png>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170517/8d414613/attachment.html 


More information about the ncl-talk mailing list