Re: questions for the usage of "txres"

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon, 24 Jul 2006 08:23:13 -0600 (MDT)

On Mon, 24 Jul 2006, deni boz wrote:

> Hi All,
> I have encountered some problems concerned with "txres". The related part
> of the script is given below:
> txres = True
> txres_at_txFontHeightF = 0.012
> txres_at_txFont = "helvetica-bold"
> gsn_text_ndc(wks,"Figure 1: Sensitivity test experiment for
> 1995-1996",0.4,0.05,txres)
> I want to add the text of "Figure 1: Sensitivity test experiment for
> 1995-1996" below my graphs. When I run the script, I got some thing like
> this: "Figure 1 AEAF"
> When I use it as "Figure 1 Sensitivity test experiment for 1995-1996", its
> okey. But I could not understand the how ":" effects this part. Should I use
> some definitions in this part of script?

Hi Deniz,

The colon (:) character in NCL is a special character for strings that
tells NCL you are about to use a special function code for doing
things like subscripts, superscripts, or change fonts in mid
string. In retrospect, the colon was a bad default choice for a
function code, but we have provided a way to change the function code
to another character.

What I recommend is that you go to:

and cut and paste the text that starts and ends with "!=====". Put
this in a file called ".hluresfile" in your home directory (yes, the
"." should be at the beginning of the filename). This file will be
read in by NCL every time you run NCL, and the settings in this file
will override the defaults set by NCL. Note the "TextFuncCode"
setting, which effectively changes the function code from a colon to a
tilde (~). This file also changes your default font to "helvetica",
your color map to one called "rainbow+gray", and sets the width
and height of your X11 window (if you ever send your graphics to the
"x11" workstation).

> I have also another question. I just want to show Figure 1 with
> helvetica-bold like this :
> Figure 1: Sensitivity test experiment for 1995-1996
> How can I do it?

I believe you were already on the right track for this by setting:

       txres_at_txFont = "helvetica-bold"

This is also a place where you can use function codes. For example,
the function code for changing a font is "F" followed by a font
number. Helvetica bold is font table #22:

so you can use the function code in this fashion:

   gsn_text_ndc(wks,"~F22~Figure 1: Sensitivity test experiment for 1995-1996",0.4,0.05,txres)

The "~" signals to NCL that you are about to give it a function code,
the "F22" is the function code followed by its value, and then the
second "~" ends the function code and goes back to normal string node.

For more information on function codes, see:


> I would really appreciate all the help you can give me to be able to solve
> this problem.
> Best regards..
> Deniz
ncl-talk mailing list
Received on Mon Jul 24 2006 - 08:23:13 MDT

This archive was generated by hypermail 2.2.0 : Mon Jul 24 2006 - 08:24:36 MDT