Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set title below a graph in gnuplot

Tags:

title

gnuplot

example:

set title "title"
plot x

This will draw a graph with a title on the top. I want to move the title under the graph. What should I do? More, how about the same problem in multiplot. I want to move the titles for every small graph s under each graph. NOTE that the title is not the title in a plot which will be placed in the keys. Many thanks!

like image 678
terry Avatar asked Mar 18 '14 10:03

terry


People also ask

What is set key in gnuplot?

The set key enables a key (or legend) describing plots on a plot. The contents of the key, i.e., the names given to each plotted data set and function and samples of the lines and/or symbols used to represent them, are determined by the title and with options of the {s}plot command.

Does gnuplot support multiple Y axes on a single plot?

5.9 Does gnuplot support multiple y-axes on a single plot? Yes. 2D plots can have separate x axes at the bottom (x1) and top (x2), and separate y axes at the left (y1) and right (y2).

What is set sample gnuplot?

set samples <samples_1> {,<samples_2>} show samples. By default, sampling is set to 100 points. A higher sampling rate will produce more accurate plots, but will take longer. This parameter has no effect on data file plotting unless one of the interpolation/approximation options is used.

How use gnuplot to plot data from a file?

To plot functions simply type: plot [function] at the gnuplot> prompt. Discrete data contained in a file can be displayed by specifying the name of the data file (enclosed in quotes) on the plot or splot command line. Data files should have the data arranged in columns of numbers.


1 Answers

The advantage of using set title is, that some vertical space is automatically reserved for it. This works only when placing the title above the graph.

You can place it below the graph only by specifying an offset. But in this case you must adapt both the offset manually and also the bottom margin:

Consider the following example:

set multiplot layout 1,3

set title "title"
plot x

set title "positive offset" offset 0,1
plot x

set title "negative offset" offset 0,-2
plot x

unset multiplot

enter image description here

As soon as you have a too large negative offset, the top margin is reset as if you would have not title, but the bottom margin remains unchanged.

So you must set a label manually below the plots and adapt the bottom margin accordingly:

set multiplot layout 1,3

set xlabel "xlabel"
set label 11 center at graph 0.5,char 1 "first title" font ",14"
set bmargin 5
plot x

set label 11 "second title"
plot x

set label 11 "third title"
plot x

unset multiplot

enter image description here

In any case you need manual intervention and tweaking of the margins.

like image 81
Christoph Avatar answered Sep 19 '22 14:09

Christoph