Re: xy plot with letters

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri, 12 May 2006 11:30:10 -0600

Hi Mike,

If you are paneling, gsn_text will not work correctly. Try using
gsn_add_text:

http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_add_text.shtml

My earlier example will work much the same way, except you have to
preallocate a graphics array to store the text:

dum = new(dimsizes(xdata),"graphic")
....
do ...
    dum(gg) = gsn_add_text(wks,plot,mlist(gg),xdata(gg),ydata(gg),tres)
end do

Adam

Michael Notaro wrote:
> Adam,
> Thanks for your help. It works but does not put the letters over the
> plot correctly.
> I have a 2 panel plot using gsn_panel. The letters should fit over the
> line plot
> in the lower panel but instead the letters appear within the center of
> the screen.
> How can I get the letters to fit within the lower panel plot?
> Thanks,
> Mike
>
> On May 11, 2006, at 5:25 PM, Adam Phillips wrote:
>
>> Hi Mike,
>>
>> Yes you can. All you have to do is use gsn_text:
>> http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_text.shtml
>>
>> Here is an example
>>
>> res = True
>> ......
>> res@gsnDraw = False
>> res@gsnFrame = False
>> plot = gsn_csm_xy(wks,xdata,ydata,res)
>>
>> tres = True
>> tres@txFontHeightF = 0.02
>> mlist = (/"J","F","M","A","M","J"/)
>> do gg = 0,dimsizes(xdata)-1
>> gsn_text(wks,plot,mlist(gg),xdata(gg),ydata(gg),tres)
>> end do
>> draw(wks)
>> frame(wks)
>>
>> Adam
>>
>> Michael Notaro wrote:
>>
>>> I have an XY plot in which the X axis is months (Jan Year 1, Feb
>>> Year 1, ..., Dec Yr 1, Jan Yr 2...).
>>> I know how to add marks to the line. However, I would like instead
>>> to add letters to the line plot,
>>> with "J" for the first time, "F", for the second, etc..., so that
>>> it is apparent which month each point
>>> pertains to. Can I do this?
>>> Thanks,
>>> Mike
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk_at_ucar.edu
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> --
>> --------------------------------------------------------------
>> Adam Phillips asphilli_at_ucar.edu
>> National Center for Atmospheric Research tel: (303) 497-1726
>> ESSL/CGD/CAS fax: (303) 497-1333
>> P.O. Box 3000
>> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri May 12 2006 - 11:30:10 MDT

This archive was generated by hypermail 2.2.0 : Wed May 17 2006 - 09:57:59 MDT