[ncl-talk] contour plot: explicit tickmark labels and repositioning XBString

Tabish Ansari tabishumaransari at gmail.com
Thu Apr 25 09:44:31 MDT 2019


Hi

I'm trying to make a contour plot from a 12x12 matrix which I'm reading
from a table. The x and y axes are automatically labelled from 0 to 12
based on the default index numbers of the data (0,11). However, I want to
explicitly define tickmark labels starting from 0 to 120 with each grid
representing a change of 10 units. I tried using *res at tmXBMode  =
"Explicit" and res at tmXBValues = ispan(0,120,10) *but that then shows only
two tickmarks (0 and 10) adapted to the index numbers. I have pasted my
script below and attached the plot.






































*load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"load
"$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"beginncol = 2 ; THE TWO
COLUMNS REPRESENT 2 DAYS: 24TH AND 30TH OCTOBERdata =
readAsciiTable("/home/tabish/Emulation/EmulPreds_responsesurface_Run2.csv",
ncol, "float", 1); THIS WILL IGNORE THE 1ST ROW WHICH IS
HEADERdata at _FillValue = -999print("table read-in
successfully")printVarSummary(data);TRANSFORMING 144X1 STRUCTURE TO 12X12
STRUCTURE FOR CONTOUR PLOTc=0a = new((/12,12/),float)do i=0,11 do j=0,11
a(i,j) = data(c,0)  c = c+1 end doend do  wks = gsn_open_wks("x11","RS") ;
Send graphics to PNG file; Set up resources.  res                     =
True  res at gsnMaximize         = True  res at cnFillOn            = True
; Turn on contour fill  res at cnFillPalette       = "amwg"      ; Set color
map  res at tiYAxisString       = "Parameter 2"  res at tiXAxisString       =
"Parameter 1"  res at cnFillMode          = "RasterFill"
res at cnLinesOn           = False  ;res at tmXBMode            = "Explicit"
;res at tmXBValues = ispan(0,120,10)  plot = gsn_csm_contour(wks,a,res)  ;
Create filled contoursend*

Also, I want to shift the X-axis label above the legendbar.

Any help would be appreciated.

Thanks,

Tabish
Tabish U Ansari
PhD student, Lancaster Environment Center
Lancaster Univeristy
Bailrigg, Lancaster,
LA1 4YW, United Kingdom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190425/870b0a7b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RS.pdf
Type: application/pdf
Size: 37726 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190425/870b0a7b/attachment.pdf>


More information about the ncl-talk mailing list