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

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue May 28 2013 - 09:30:46 MDT

Hi Arne,

Thanks for providing a simple program that illustrates what you are talking about.

We actually have a trouble ticket for what you are requesting (NCL-148). I'll add your email to the ticket. Right now there's no easy way to fix this.

The method you've used below with the overlay call is probably the best work-around. It's similar to what we have in example 10 at:

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

--Mary

On May 27, 2013, at 5:57 AM, Arne Melsom wrote:

> 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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue May 28 09:30:56 2013

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