[ncl-talk] add text problem in Draw Order

Mary Haley haley at ucar.edu
Fri Aug 22 08:16:51 MDT 2014


Hi Erika,

Whenever you call gsn_text or gsn_text_ndc, the text is drawn at that
moment. This means if you draw anything later, it will likely be drawn on
top of the text.

You try calling gsn_text_ndc after you call gsn_attach_plots, but you may
need to adjust your string position and size.

--Mary



On Wed, Aug 20, 2014 at 3:42 PM, Erika Folova <e.folova at gmail.com> wrote:

> Hallo,
>
> I have a question,, why the text that I added on top of my polygons hid
> behind them..
> can you suggest me why?
>
> [SNIP]
>
> ymin = new(3,float)
>   ymax = new(3,float)
>   do i=0,2
>     getvalues plot(i)
>       "trYMinF": ymin(i)
>       "trYMaxF": ymax(i)
>     end getvalues
>   end do
>
>
>   xmin = (/1990,2060/)
>   xmax = (/2030,2099/)
>
>   xbars = (/ (/xmin(0), xmax(0), xmax(0), xmin(0), xmin(0)/), \
>              (/xmin(1), xmax(1), xmax(1), xmin(1), xmin(1)/)/)
>
>   ybars = (/ (/ymin(0),ymin(0),ymax(0),ymax(0),ymin(0)/), \
>              (/ymin(1),ymin(1),ymax(1),ymax(1),ymin(1)/), \
>              (/ymin(2),ymin(2),ymax(2),ymax(2),ymin(2)/)/)
>
>
> ;;;;;; Create the bars and attach to appropriate plot
>   gres             = True
>   gres at gsFillColor = "gray95"
>
>   do i=0,1
>     do j=0,2
>       poly((i*4)+j) =
> gsn_add_polygon(wks,plot(j),xbars(i,:),ybars(j,:),gres)
>     end do
>   end do
>
> ; add text =========
>
> *  txres                       = True*
> *  txres at txPerimOn             = False*
> *  txres at txFontHeightF         = 0.0085*
> *  txres at txBackgroundFillColor = "White"*
> *  txres at txPolyDrawOrder       = "PreDraw"*
>
> *  gsn_text_ndc(wks,"Prob="+sprintf("%5.3f", prob1)+" ("+sprintf("%5.3f",
> prob2)+"), T= "+sprintf("%5.3f", rc1*10)+" ("+sprintf("%5.3f", rc2*10)+")
> ~C~|tval|="+sprintf("%5.2f",abs(rc1 at tval))+" ("+sprintf("%5.2f",rc2 at tval)
> +")",0.235,0.915,txres)*
>
>
> ; plot all
> ;===================
>
>   attachres1                     = True
>   attachres1 at gsnAttachPlotsXAxis = True
>   attachres1 at gsnAttachBorderOn   = False
>   attachres2                     = True
>   attachres2 at gsnAttachPlotsXAxis = True
>   attachres2 at gsnAttachBorderOn   = False
>
>   attachid1  = gsn_attach_plots(plot(0),plot(1:2),attachres1,attachres2)
>
>   pres = False               ; No resources needed
>   maximize_output(wks,pres)  ; Maximize plot on page
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140822/1f669efe/attachment.html 


More information about the ncl-talk mailing list