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

From: Craig Tierney - NOAA Affiliate <craig.tierney_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 26 2014 - 13:26:41 MST

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
>
>
Received on Wed Feb 26 13:27:28 2014

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