Hi Phillippe,
There doesn’t appear to be a way to clip text that falls outside the plot. I tried this simple script:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
wks = gsn_open_wks("x11","map")
res = True
res@mpCenterLonF = -60
res@gsnDraw = False
res@gsnFrame = False
plot = gsn_csm_map(wks,res)
txres = True
txres@txFontHeightF = 0.04
txres@txJust = "CenterLeft"
id = gsn_add_text(wks,plot,"hello",-240,0,txres)
draw(plot)
frame(wks)
end
and the only thing I could do was set txJust to “CenterLeft”, as you see above.
I’ve created a new example that shows how to remove text strings that fall outside a plot’s borders. It’s a bit complex, because you first need to add the strings, and then retrieve their locations to see if they are outside the borders. The NhlRemoveAnnotation procedure is then used to remove the offending text strings.
This example was based on “text_10.ncl” on our examples page.
See “text_17.ncl” at:
http://www.ncl.ucar.edu/Applications/text.shtml
—Mary
On Jan 5, 2014, at 9:30 PM, Philippe Papin <ppapin@albany.edu> wrote:
> Hi NCL Talk,
>
> I have what is hopefully a simple problem. I've been making a simple black and white map with tropical cyclone tracks overlaid (with a text box located to the upper right of the track highlighting the system's name). Occasionally this textbox appears on the edge of the map domain and overlaps with the map viewport, creating an image that looks like this:
>
> http://www.atmos.albany.edu/student/ppapin/lb13_img/html/gridsat_grid/ibtracs_trans_atl_73.png
>
> Instead of the remainder of the text showing up outside of the map, I'd like it to be buried underneath without any visible information outside of the map domain. In its current configuration it makes the horizontal size of the image larger than it needs to be (note the differences between the text outside of the map vs. text only inside of the map).
>
> Is this possibly a viewport issue? I am using gsn_add_text to write text to the map domain. I would be happy to provide additional code if necessary to figure out what is going on.
>
> Thanks,
> Philippe
>
> --
> -------------------------------------
> Philippe P. Papin
> Dept. of Atmospheric and Environmental Sciences
> University at Albany, SUNY
> 1400 Washington Ave, Albany, NY 12222
> http://www.atmos.albany.edu/student/ppapin/
> _______________________________________________
> 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 Mon Jan 06 11:18:06 2014
This archive was generated by hypermail 2.1.8 : Mon Jan 06 2014 - 13:09:53 MST