Hi all ncl users;
I would like to make a 2D contour plot without map for my data. Suppose we have X, Y and Z data and we want to generate 2D contour with X and Y axis. I simply use the following code, for my data (X=distance, Y = distance, Z=data1):
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
begin
; read in data
ncols = 200
nrows = 4800
data = asciiread ("inactmeanRXradar.txt", (/nrows,ncols/), "float")
distance = asciiread ("distance.txt", (/200,1/), "float")
data1=data(1:200,:)
wks = gsn_open_wks("png","conwomap") ; open a wks
gsn_define_colormap(wks,"gui_default") ; choose a colormap
X = distance
Y = distance
Z=data1
res = True
res@cnRasterModeOn = False
res@cnFillOn = True
res@cnLinesOn = False
res@cnLineLabelsOn = False
res@tmYLMinorOn = True
res@tmXBMinorOn = True
res@tiYAxisFontHeightF = 0.015
res@tiXAxisFontHeightF = 0.015
res@vpWidthF = 0.5 ; change aspect ratio of plot
res@vpHeightF = 0.3
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = 0
res@cnMaxLevelValF = 2
res@cnLevelSpacingF = 0.05
plot = gsn_csm_contour(wks,Z,res) ; contour the variable
end
Question: By using the current code, X and Y axis represent the grid number of Z. Actually what I need is X = distance, and Y = distance (from distance.txt file). How to involve X and Y in gsn_csm_contour directly ? Or are there any other option to plot this kind of data ?
Thanks very much for sharing.
Joueky
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 26 04:10:00 2013
This archive was generated by hypermail 2.1.8 : Thu Feb 28 2013 - 14:47:31 MST