Re: Why ~C~ does not work when I want to add a carriage return in the main title? Thanks!

From: Wen.J.Qu <wen.j.qu_at_nyahnyahspammersnyahnyah>
Date: Fri Oct 26 2012 - 11:48:14 MDT

Thanks, Mary

I download the .hluresfile file and put it into my /home/ directory, it finally works.

Thank you so much.


All my best!


Shawn






Wen.J.Qu
2012-10-26



发件人: Mary Haley
发送时间: 2012-10-26 12:08:46
收件人: Wen.J.Qu@gmail.com
抄送: ncl-talk
主题: Re: [ncl-talk] Why ~C~ does not work when I want to add a carriage return in the main title? Thanks!

The default function code in NCL V6.0.0 and earlier is a colon (:). If you want to use "~" as the function code, then you either need to set:

   res@tiMainFuncCode = "~"

or, better, create a ".hluresfile" in your home directory and make "~" your default function code for all NCL scripts with this line:

*TextFuncCode : ~

Really, you should go to:

http://www.ncl.ucar.edu/Document/Graphics/hlures.shtml

and learn more about the .hluresfile, as you can also set your default font and color table.

In V6.1, "~" will be the default function code.

--Mary

On Oct 26, 2012, at 9:56 AM, Wen.J.Qu wrote:

>
> Hi, all
>
> I want to add a carriage return in the main title, but the "~C~" (on the red line of the code below) does not work (plot below).
>
> Would you please help me with this? Thanks a lot!
>
>
> Shawn
>
>
> *****************************************************
> <Catch1.bmp >
> *****************************************************
>
>
> *****************************************************
> ;===========================================================================
> ; Begin plotting section. ("corre_visib_gm" to PS workstation and use another background map)
> ;
>
> pswks = gsn_open_wks("ps","corre_visib_gm") ; Open an PS workstation and
> gsn_define_colormap(pswks,"BlueRed") ; define a different colormap.
>
> ;
> ; This will not be necessary in V6.1.0 and later. Named colors can
> ; be used without having to first add them to the color map.
> ;
>
> nc1 = NhlNewColor(pswks,.7,.7,.7) ; Add light gray to colormap,
> ; for continents.
> ;
> ; Set up some map resources.
> ;
> mpres = True
> mpres@gsnMaximize = False ; Don't maximize plot in frame.
> mpres@gsnFrame = False ; Don't advance the frame
>
> mpres@mpDataSetName = "Earth..4" ; This new database contains
> ; divisions for other countries.
> mpres@mpDataBaseVersion = "MediumRes" ; Medium resolution database
> mpres@mpOutlineOn = True ; Turn on map outlines
> mpres@mpOutlineSpecifiers = (/"China:states","Taiwan"/) ;China:states
>
> mpres@mpGeophysicalLineThicknessF= 2. ; double the thickness of geophysical boundaries
> mpres@mpNationalLineThicknessF= 2. ; double the thickness of national boundaries
>
> ;mpres@mpProjection = "LambertConformal" ; change map to Lambert Project
> ;mpres@mpLambertMeridianF = 110.0
> ;mpres@mpLimitMode = "LatLon"
> ;mpres@mpLambertParallel1F = .001 ;Default: .001
> ;mpres@mpLambertParallel2F = 89.999 ;Default: 89.999
> ;
> ; Zoom in on P. R. China.
> ;
> mpres@mpMinLatF = 17.
> mpres@mpMaxLatF = 55.
> mpres@mpMinLonF = 72.
> mpres@mpMaxLonF = 136.
>
> mpres@mpFillColors = (/-1,-1,nc1,-1/) ;assign light gray to land masses
>
> mpres@tiMainString = "Correlation between 25th percentile Vis and WPSH index (gm) ~C~ 1973 to 2011 (99% significance)"
>
> ; Set up the position of the plot
> mpres@vpWidthF = 0.8
> mpres@vpHeightF = 0.6
> mpres@vpXF = 0.15
> mpres@vpYF = 0.8
>
> map = gsn_csm_map(pswks,mpres)
>
> ;
> ; Create logical variables to hold the marker and text resources.
> ; These markers are different than the XY markers, because they are not
> ; associated with an XY plot. You can put these markers on any plot.
> ;
> gsres = True
> gsres@gsMarkerIndex = 16 ; Use filled dots for markers.
>
> txres = True
> txres@txFontHeightF = 0.015
>
> ;
> ; Loop through each grouping of markers, and draw them one set at
> ; a time, assigning the proper color and size with gsn_marker.
> ;
> ; At the same time, draw a legend showing the meaning of the markers.
> xleg = (/0.05,0.29,0.53,0.77,0.05,0.29,0.53,0.77/) ; Location of
> xtxt = (/0.17,0.41,0.65,0.89,0.17,0.41,0.65,0.91/) ; legend markers
> yleg = (/0.17,0.17,0.17,0.17,0.12,0.12,0.12,0.12/) ; and text
> ytxt = (/0.17,0.17,0.17,0.17,0.12,0.12,0.12,0.12/) ; strings
>
> do i = 0, num_distinct_markers-1
>
> gsres@gsMarkerColor = colors(i)
>
> if (i.le.3) then
> gsres@gsMarkerThicknessF = 1.5*((3-i)+1)
> else
> gsres@gsMarkerThicknessF = 1.5*((i-3)+1)
> end if
>
> if (.not.ismissing(lat_new(i,0)))
>
> gsn_polymarker(pswks,map,lon_new(i,:),lat_new(i,:),gsres)
>
> end if
>
> ;
> ; Add marker and text for the legend.
> ;
>
> gsn_polymarker_ndc(pswks, xleg(i),yleg(i),gsres)
> gsn_text_ndc (pswks,labels(i),xtxt(i),ytxt(i),txres)
>
> end do
>
> frame(pswks) ; Advance the frame.
> *****************************************************
>
> Wen.J.Qu
> 2012-10-26
> _______________________________________________
> 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 Fri Oct 26 11:48:29 2012

This archive was generated by hypermail 2.1.8 : Wed Oct 31 2012 - 09:14:12 MDT