Re: text over a grid

From: Rosemarie Drummond <rmarie_at_nyahnyahspammersnyahnyah>
Date: Tue Mar 26 2013 - 10:10:25 MDT

Thanks Mary,
     This put me on the right track - I think the problem was connected
to calls to gsn_add_polyline - I changed it to gsn_polyline, tidied up a
few other things and it is now fine
Thanks
Rosemarie
On 22/03/2013 12:58 PM, Mary Haley wrote:
> Hi Rosemarie,
>
> If you are adding the text using gsn_add_text, then this should always
> cause the text to get drawn on top of the plot.
>
> If you are just using gsn_text, however, you have to make sure you
> draw the plot first, and then the text.
>
> Here's how your code might look if you use gsn_add_text:
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> begin
> f = addfile ("$NCARG_ROOT/lib/ncarg/data/cdf/uv300.nc","r")
> u = f->U
>
> wks = gsn_open_wks ("x11","xy")
>
> res = True
> res@tmXMinorGrid = True
> res@gsnDraw = False
> res@gsnFrame = False
> plot = gsn_csm_xy (wks,u&lat,u(0,:,{82}),res)
>
> txres = True
> txres@txFontHeightF = 0.03
> txres@txPerimOn = True
> txres@txBackgroundFillColor = "red"
> txid = gsn_add_text(wks,plot,"hello world",0,20,txres)
>
> draw(plot) ; Drawing "plot" will also draw attached text string.
> frame(wks)
> end
>
>
> Here's how it should look if you just use gsn_text:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> begin
> ;---read in data
> f = addfile ("$NCARG_ROOT/lib/ncarg/data/cdf/uv300.nc","r")
> u = f->U
>
> wks = gsn_open_wks ("x11","xy")
>
> res = True
> res@tmXMinorGrid = True
> res@gsnFrame = False ; >eave gsnDraw alone!
> plot = gsn_csm_xy (wks,u&lat,u(0,:,{82}),res) ; Draw plot, don't
> advance frame
>
> txres = True
> txres@txFontHeightF = 0.03
> txres@txPerimOn = True
> txres@txBackgroundFillColor = "red"
> gsn_text(wks,plot,"hello world",0,20,txres) ; Text will be drawn on plot
>
> frame(wks)
> end
>
>
> On Mar 21, 2013, at 11:05 AM, Rosemarie Drummond wrote:
>
>> Unfortunately this doesn 't seem to solve the problem. The grid lines
>> seem to go on last.
>> the data in the plot is shown with 3 sets of polymarkers which are
>> affected by the value of tfPolyDrawOrder but even if I set it to
>> PostDraw in the resources for a particular set of markers, the grid goes
>> over them.
>> Rosemarie
>>
>> On 21/03/2013 1:20 PM, Adam Phillips wrote:
>>> Hi Rosemarie,
>>> I'm not 100% sure on this but try setting tfPolyDrawOrder = "PostDraw"
>>> in your text resource list. If that does not work let ncl-talk know..
>>> http://www.ncl.ucar.edu/Applications/draworder.shtml
>>> Adam
>>>
>>> On 03/21/2013 09:56 AM, Rosemarie Drummond wrote:
>>>> I am making an xy-plot with gsn_csm_xy and I have tmXMinorGrid=True
>>>> Later I add text in a box using txPerimOn=True and
>>>> txBackgroundFillColor="red"
>>>>
>>>> Is it possible for the text box to cover the gridlines so that they do
>>>> not show through?
>>>> Thanks
>>>> Rosemarie
>>>>
>>
>>
>> --
>> Dr Rosemarie Drummond
>> rmarie@atmosp.physics.utoronto.ca
>> <mailto:rmarie@atmosp.physics.utoronto.ca>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
Dr Rosemarie Drummond
rmarie@atmosp.physics.utoronto.ca
Received on Tue Mar 26 10:10:35 2013

This archive was generated by hypermail 2.1.8 : Thu Apr 04 2013 - 21:06:41 MDT