Re: Drawing Order of Grid Lines

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Aug 12 2011 - 09:26:46 MDT

Hi Bruce,

I fought with this a bit and couldn't get it to work. I tried creating a blank plot with grid lines, so
I could overlay the histogram on top of that, but it still didn't work. I think NCL wants those
tickmark grid lines to be drawn last no mater what.

And no, unfortunately there's no "DrawOrder" resource for tickmarks. I created a ticket for this,
NCL-1176.

FYI, you can see all of the draw order resources at:

http://www.ncl.ucar.edu/Applications/draworder.shtml

Anyway, the only way I could get this to work was to draw the histogram twice: the first time
with grid lines, and the second time without. I'm hoping Dave might have a better
solution:

; histo_1.ncl
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
begin
 x = new(1000,integer)
 do i=0,dimsizes(x)-1
   x(i) = rand()
 end do
 x = x/320
 pfmt = "eps"
 pfmt = "x11"
 wks = gsn_open_wks(pfmt,"zhisto")
 gsn_define_colormap(wks,"temp1")

 res = True

 res@gsnFrame = False

 res@gsnPaperOrientation = "landscape"

 res@tmXMajorGrid = True
 res@tmXMajorGridLineDashPattern = 2
 res@tmYMajorGrid = True
 res@tmYMajorGridLineDashPattern = 2

 plot_w_grid=gsn_histogram(wks,x,res)

 delete(res@tmXMajorGrid)
 delete(res@tmXMajorGridLineDashPattern)
 delete(res@tmYMajorGrid)
 delete(res@tmYMajorGridLineDashPattern)

 plot_wo_grid=gsn_histogram(wks,x,res)

 frame(wks)
end

--Mary

On Aug 11, 2011, at 3:32 PM, Lunde, Bruce N CIV NAVOCEANO, NP1 wrote:

> Hello, I am drawing a histogram with grid lines turned on.
> I wish the grid lines to be drawn underneath the boxes.
> I have tried
> res@tfPolyDrawOrder = "PostDraw"
> but that does not seem to work.
>
> Are there options such as
> tmGridDrawOrder = "PreDraw"
> tmMajorGridDrawOrder = "PreDraw"
> tmXMajorGridDrawOrder = "PreDraw"
> etc. ??
>
> Thanks, Bruce
>
> Here is my basic code modifying one of your examples:
>
> ; histo_1.ncl
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> begin
> x = new(1000,integer)
> do i=0,dimsizes(x)-1
> x(i) = rand()
> end do
> x = x/320
> pfmt = "eps"
> pfmt = "x11"
> wks = gsn_open_wks(pfmt,"zhisto")
> res = True
> res@tmXMajorGrid = True
> res@tmXMajorGridLineDashPattern = 2
> res@tmYMajorGrid = True
> res@tmYMajorGridLineDashPattern = 2
>
> res@tfPolyDrawOrder = "PostDraw" ;.. NOT SEEM TO HELP
>
> res@gsnPaperOrientation = "landscape"
>
> gsn_define_colormap(wks,"temp1")
> plot=gsn_histogram(wks,x,res)
> end
> _______________________________________________

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Aug 12 09:26:52 2011

This archive was generated by hypermail 2.1.8 : Fri Aug 12 2011 - 11:48:30 MDT