Re: Line thickness

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon, 11 May 2009 09:04:03 -0600 (MDT)

If you know what your contour levels are in advance, then
you can use the cnLineThicknesses resource, using an
array of line thicknesses that is the same length as
the number of levels you have:

  res_at_cnLevelSelectionMode = "ExplicitLevels"
  res_at_cnLevels = (/-2.,-1.,0.,1.,2./)
  res_at_cnLineThicknesses = (/ 2., 1.,1.,1.,1./)

If you don't know the contour levels, then you will need to create the
plot first (turning off gsnFrame and gsnDraw) retrieve the contour
levels, loop through the levels and set the thicknesses accordingly,
and then create and draw the plot.

Untested:

;
; Create the plot, but don't draw it just yet.
;
   ...
   res_at_gsnDraw = False
   res_at_gsnFrame = False
   ...
   plot = gsn_csm_contour_map(wks,data,res)

;
; Retrieve the contour levels.
;
   getvalues plot_at_contour
     "cnLevels" : levels
   end getvalues

;
; Create array to hold contour line thicknesses.
;
   nlevels = dimsizes(levels)
   cnthck = new(levels,float)

;
; Loop through the levels, find the one you want, and set the
; thickness for that level. Default the rest to 1.0.
;
   conlevel = -2.0
   eps = 0.001
   do i=0,nlevels-1
     if(levels(i).gt.(conlevel-eps).and.levels(i).lt.(conlevel+eps)) then
       cnthk(i) = 2.0
     else
       cnthk(i) = 1.0
     end if
   end do

;
; Set the cnLineThicknesses resource, and recreate the plot, this
; time drawing it.
;
   delete(res_at_gsnDraw)
   delete(res_at_gsnFrame)
   res_at_cnLineThicknesses = cnthck
   plot = gsn_csm_contour_map(wks,data,res)

--Mary

On Mon, 11 May 2009, Michel dos Santos Mesquita wrote:

> Hi everyone,
>
> I know NCL has the function 'gsnContourZeroLineThicknesssF', to set
> the thickness of the zero contour.
>
> How can I change the thickness of line corresponding to another value?
> For example, if I want to change the thickness of the -2C Temperature?
>
> THanks,
>
> Michel
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon May 11 2009 - 09:04:03 MDT

This archive was generated by hypermail 2.2.0 : Mon May 11 2009 - 09:43:46 MDT