Re: Can I put a legend on top of grid lines?

From: Arne Melsom <arne.melsom_at_nyahnyahspammersnyahnyah>
Date: Mon May 27 2013 - 05:57:11 MDT

Just to be a little more specific, I'm wondering if there's an appropriate option for this. I realize that it can be achieved using overlay (see modified example below).
A.

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin

pi = 4.*atan(1.)
x = fspan(-pi,pi,100)
y = sin(x)

wks = gsn_open_wks ("x11","samplePlot")

res1 = True

res1@tmXMajorGrid = True
res1@tmYMajorGrid = True

res1@gsnFrame = False

plot1 = gsn_csm_xy(wks,x,y,res1)

res2 = res1

res2@tmXMajorGrid = False
res2@tmYMajorGrid = False

res2@xyExplicitLabels = " y=sin(x)"

res2@lgLabelFontHeightF = 0.02
res2@lgPerimFill = "SolidFill"
res2@lgPerimFillColor = "cyan"

res2@pmLegendDisplayMode = "Always"
res2@pmLegendOrthogonalPosF =-0.85
res2@pmLegendParallelPosF = 0.25
res2@pmLegendWidthF = 0.1
res2@pmLegendHeightF = 0.05

plot2 = gsn_csm_xy(wks,x,y,res2)

overlay(plot1,plot2)
frame(wks)

end

----- Original Message -----
> Hi!
> I'd like to draw a label inside a figure, on top of grid lines. Is
> this possible? If so, how do I change the script below? I'm using v.
> 6.1.0.
> Thanks!
> Arne M.
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> begin
>
> pi = 4.*atan(1.)
> x = fspan(-pi,pi,100)
> y = sin(x)
>
> wks = gsn_open_wks ("x11","samplePlot")
>
> res = True
>
> res@tmXMajorGrid = True
> res@tmYMajorGrid = True
>
> res@xyExplicitLabels = " y=sin(x)"
>
> res@lgLabelFontHeightF = 0.02
> res@lgPerimFill = "SolidFill"
> res@lgPerimFillColor = "cyan"
>
> res@pmLegendDisplayMode = "Always"
> res@pmLegendOrthogonalPosF =-0.85
> res@pmLegendParallelPosF = 0.25
> res@pmLegendWidthF = 0.1
> res@pmLegendHeightF = 0.05
>
> plot = gsn_csm_xy(wks,x,y,res)
>
> end
> _______________________________________________
> 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 27 05:57:22 2013

This archive was generated by hypermail 2.1.8 : Thu May 30 2013 - 11:38:10 MDT