question about coloring lines in x-y plot

From: Erik Noble <nobleeu_at_nyahnyahspammersnyahnyah>
Date: Fri May 20 2011 - 19:19:18 MDT

Hi, is there a way to use the range of a color table to color all lines
drawn in an x-y plot, instead of having to name each color or color-index?
Is there an example of this? Maybe I missed it.
I have 32 line, as shown in my plots.

My code is below.
Thank you in advance.

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/csm/contributed.ncl"
begin
  ;***** TRMM precipitation ********
  filO = "hov_ncpr2_rv.nc"
  dirM = "./"
  filM = "hov_regridded_rv_700_Experiment_*"

;***** OBSERVED precipitation ********
obs = addfile(filO,"r")
obsv = obs->rv ;rain
rain_obs = obsv

all_files = systemfunc ("ls "+dirM+filM)
;print(all_files)
numFILES = dimsizes(all_files)
f = addfiles (all_files+".nc", "r")
ListSetType (f, "join")
r = f[:]->rv
rain_model = r(:,1::,:)
dimp = dimsizes(rain_model)

; check data
printVarSummary(rain_obs)
printVarSummary(rain_model)

;;;;;; MAKE ARRAY FOR CC ;;;;;;;;;;;;;;;
ARRAY = new ( (/numFILES,12/), float,-9999)
ARRAY2 = new ( (/numFILES,12/), float,-9999)
;******************************
; Generate Correlation Coefficient
;******************************
do i = 0, 31, 1
   do j=0,11,1
   ARRAY(i,j) =
escorc(ndtooned(rain_model(i,0:j,:)),ndtooned(rain_obs(0:j,:)))
   ARRAY2(i,j)=
escorc(ndtooned(rain_model(i,j:11,:)),ndtooned(rain_obs(j:11,:)))
  end do
end do

printVarSummary(ARRAY)
printMinMax(ARRAY,True)
printVarSummary(ARRAY2)
printMinMax(ARRAY2,True)

   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Make Plot
   wks = gsn_open_wks("ps","xy")
   x=ispan(1,12,1)
   res = True
   res@trYMaxF = 0.70
   res@trYMinF = -0.70
   ;res@tiMainString = "Title"
   res@tiYAxisString = "Correlation Coefficient"
   res@tiXAxisString = "Days"
  ; res@xyLineColors = (/ /)
  ; res@xyLineThicknesses = (/ /) ; line thicknesses
  ; res@xyDashPatterns = (/ /) ; line patterns
  ; res@xyDashPattern = 1 ; Make curves all solid
   res@xyMarkLineMode = "MarkLines" ; Markers *and* lines
   res@trXMinF = 1

   res@tmXBLabels = ispan(1,12, 1)
   res@tmLabelAutoStride = True
   plot = gsn_csm_xy(wks,x,ARRAY,res)

   plot = gsn_csm_xy(wks,x,ARRAY2,res)
end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Fri May 20 19:19:31 2011

This archive was generated by hypermail 2.1.8 : Wed May 25 2011 - 09:35:33 MDT