How can I justify shortcuts when building “tags” in Gnuplot?

The following plot command creates a histogram, and above each column the value is displayed as a label formatted with gprintf:

plot "data.txt" using 6:1 index 0 notitle with boxes linestyle 1,\
     "data.txt" using 6:(0.7):(gprintf("%5.2f", $1)) index 0 notitle \
                                       with labels font "Courier,34" rotate left

I want the value labels to be right-aligned, so I can use the more convenient Helvetica font instead of Courier to align the decimal points.

So how do you include inclusion in the above command?

I was not able to find anything about this specific issue in the Gnuplot documentation or on the Internet. Other shortcuts can be easily justified, but is this also possible when building with labels?

+5
source share
2 answers

, , :

...
plot "test.dat" using ..., \
"" using ($1-100000):2:3 with labels rotate left notitle
...

... "rotate left" .

, "" "" ; - gnuplot. , help set label - , , ;

$ gnuplot
...
    G N U P L O T
    Version 4.4 patchlevel 2
...

Terminal type set to 'wxt'
gnuplot> help with labels
Sorry, no help for 'with labels'
gnuplot> help with 
 Functions and data may be displayed in one of a large number of styles.
 The `with` keyword provides the means of selection.

 Syntax:
       with  { {linestyle | ls }
...
where  is one of

      lines        dots       steps     errorbars     xerrorbar    xyerrorlines
      points       impulses   fsteps    errorlines    xerrorlines  yerrorbars
      linespoints  labels  ...
...
gnuplot> help labels
 The `labels` style reads coordinates and text from a data file and places
 the text string at the corresponding 2D or 3D position.  3 or 4 input columns
 of basic data are required.  ....

      3 columns:  x  y  string    # 2D version
...
 See also `datastrings`, `set style data`.

gnuplot> help set label
 Arbitrary labels can be placed on the plot using the `set label` command.

 Syntax:
       set label {} {""} {at }
                 {left | center | right}
                 {norotate | rotate {by }}
                 ...
 By default, the text is placed flush left against the point x,y,z.  To adjust
 the way the label is positioned with respect to the point x,y,z, add the
 justification parameter, which may be `left`, `right` or `center`,
 indicating that the point is to be at the left, right or center of the text.
 Labels outside the plotted boundaries are permitted but may interfere with
 axis labels or other text.

 If `rotate` is given, the label is written vertically (if the terminal can do
 so, of course).  If `rotate by ` is given, conforming terminals will
 try to write the text at the specified angle; non-conforming terminals will
 treat this as vertical text.

; , - rotate left OP, , left rotate, - left , rotate (.. rotate left " 90 ", ).

, :

...
plot "test.dat" using ..., \
"" using ($1-100000):2:3 with labels left rotate notitle
...

... . left right, :

...
plot "test.dat" using ..., \
"" using ($1-100000):2:3 with labels right rotate notitle
...

... , "" ( 90 ), .

, , ,
!

+5

5 , "%5.2f". 2 , 2 . , , 0.7, , . , Helvetica , . , - ".11" ".88" .

0

All Articles