FAQ

Colored labels

Colored labels

Question:

How do I specify the color of text labels?

Example:

In PyFerret, use the SET TEXT command, and name a color or give an RGB description of a color. All subsequent text placed on the page will use that text color and style, until another SET TEXT command is issued or the plot is saved with FRAME. In addition, SET TEXT can customize the color and text style for specific text groupings, such as moveable labels, titles, and so forth.

The remainder of the FAQ discusses classic Ferret techniques.  These will work in PyFerret if you have set the font to the Hershey Font "SET TEXT/FONT=hershey

Try this:

! a sample plot
go fland 60 black basemap
 
! a standard black label (pen=1 default -- same as using "@P1")
label 50 -60 -1 0 .2 Here is a label in black
 
! a red label
label 50 -80 -1 0 .2 @P2Here is a label in red
 
! a white label -- redefine pen 6 to be white (100% on R,G, and B)
ppl color 6 100,100,100
label 50 -80 -1 0 .2 @P6Here is a label in white

Solution:

Use "@Pn" in your label string to select among the 6 predefined line/textcolors as in the examples above. Try

yes? GO line_samples

to see the choices.

If the color you need is not among the default choices you can redefine any of them using the "PPL COLOR" command (see PPL COLOR in the Ferret documentation, chapter PLOT+ Enhancements Guide). The colors settings will be applied on the hard copy, too.

 

Or, use @Cnnn in the label string, where nnn is the color/linenumber specifier; see the table marked "The following PPLUS commands use the color_thickness index" in this section in Chapter 6.

Here, the title must be drawn with a non-ascii font such as @CR so that the @Cnnn color-change codes will be interpreted.

yes? plot/title="@CR@C002Red@c003Green@C004Blue @C001Title"/i=1:10 1./i
yes? annotate/norm/x=0.5/y=1.1/size=0.2 "@C002this@c003changes@C004color"