Re: Why doesn't my text show up in my plot?

From: Jatin Kala <jatin.kala.jk_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 26 2014 - 15:03:06 MST

I don't think you can use gsn_add_text to plot outside the plot area, since the x and y co-ordinate of the string has to be within the range of the data's (x,y) range being plotted:
http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_add_text.shtml
If neither gsn_add_text or gsn_text_ndc is working for you, my suspicion/gut instinct is that you are calling these before an overlay or panel procedure? Make sure it's called last. And gsn_maximize sometimes does weird stuff (i don't usually use it), but not sure if you are.
Hope this helps,
Cheers,
Jatin.

On 27/02/2014, at 7:54 AM, Craig Tierney - NOAA Affiliate wrote:

> Mary,
>
> I will try and come up with an example. The gsn_add_text isn't working either. Now, I could be using it wrong (most likely).
>
> My question is, should gsn_add_text be able to plot text outside of the boundary of the plot map?
>
> Thanks,
> Craig
>
>
> On Wed, Feb 26, 2014 at 1:26 PM, Craig Tierney - NOAA Affiliate <craig.tierney@noaa.gov> wrote:
> On Wed, Feb 26, 2014 at 12:45 PM, Mary Haley <haley@ucar.edu> wrote:
> Craig,
>
> Can you trim this down to a short but complete script that illustrates the problem? I can't tell from looking at the code snippet what might be going on.
>
>
> I will see what I can do. The plotting script is really 1000+ lines of NCL that allow me plot any dataset, from any resolution, of any meteorological field, and just do the right thing. This script is plotting a data on a icosahederal grid.
>
> There could be a maximization issue, or maybe one plot element is covering up another, etc.
>
> Note: generally I recommend against using gsn_text_ndc (or any of the gsn_xxx_ndc procedures) if you can use gsn_add_xxx instead.
>
>
> I was not a fan of working in NDC space, but it did help me simplify my code because when the scripts change domain (eg. global to conus), then I would have to rescale the coordinates. In NDC space and an assumption of where the plot ends up, I can safely tuck away the text in the corner of the plot.
>
> The difference, of course, is that with gsn_xxx_ndc you need to use NDC coordinates (coordinates from 0 to 1), whereas with the gsn_add_xxx functions you need to use the plot's coordinate space. Also, with gsn_xxx_ndc, the primitive gets drawn right in that moment and it is *not* attached to anything. The gsn_add_xxx function will attach the primitive to the plot, but not draw it. So, you have to draw the plot in order to see the primitive. But, the benefit is if you resize the plot, then the primitive will be resized automatically.
>
>
> I will try the gsn_add_text and see if that resolves the order issue.
>
> Craig
> --Mary
>
> On Feb 26, 2014, at 11:59 AM, Craig Tierney - NOAA Affiliate <craig.tierney@noaa.gov> wrote:
>
> > I am using ncl 6.1.2. When I try to call gsn_text_ndc before the call to gsn_csm_contour_map, the text displays.
> >
> > ----------------------------
> > ; Create a control string for the plot
> > cstr="Min/Max control: "+min(d1)+"/"+max(d1)+" "+"Min/Max Diff: "+min(data)+"/"+max(data)
> > print(cstr)
> >
> > ; Attach all necessary labels
> > txresb = True
> > txresb@txFontHeightF = 0.010
> > gsn_text_ndc(wks,cstr, 0.5, 0.1, txresb)
> >
> > ; plot the map
> > map = gsn_csm_contour_map(wks,data,res)
> >
> > draw(map)
> > -----------------------------
> >
> > When I reverse it, the text does not display.
> >
> > ----------------------------
> > ; Create a control string for the plot
> > cstr="Min/Max control: "+min(d1)+"/"+max(d1)+" "+"Min/Max Diff: "+min(data)+"/"+max(data)
> > print(cstr)
> >
> > ; plot the map
> > map = gsn_csm_contour_map(wks,data,res)
> >
> > ; Attach all necessary labels
> > txresb = True
> > txresb@txFontHeightF = 0.010
> > gsn_text_ndc(wks,cstr, 0.5, 0.1, txresb)
> >
> > draw(map)
> > -----------------------------
> >
> > Why is this and is there a way to enable additional debugging so that I could see what NCL is doing when I run into future problems like this?
> >
> > Thanks,
> > Craig
> > _______________________________________________
> > 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 Wed Feb 26 15:03:25 2014

This archive was generated by hypermail 2.1.8 : Mon Mar 03 2014 - 14:26:18 MST