Discussie forum over de Meteobridge / Meteohub. Voor vragen, specificaties, ervaringen etc..
Door WeerstationGraveNL
#16710
Op het Meteohub-forum vond ik deze codes voor de Meteohub grafieken.
Heb even niet de tijd om ze te vertalen, maar ik zet ze voor de zekerheid hier maar alvast weg:



The gnuplot manual: http://www.gnuplot.info/docs/gnuplot.html

Localization:
To change the language in the graphs from english to another language, add the following command:
set locale "de_DE"|
Replace the de_DE with your localization-code http://www.gnuplot.info/docs/node196.html

PNG-Options:
To change the color of the background, axes, curves, and the fontsize.
The background color is set first, then the border colors, then the X & Y axis colors, then the plotting colors. The maximum number of colors that can be set is 256.
set terminal png transparent 9|
This sets the background to transparent and the fontsize to 9pt.
http://www.gnuplot.info/docs/node268.html <- Terminal command
http://www.gnuplot.info/docs/node409.html <- PNG command

Axes:
To change the behavior of the axes use the following commands:
set tics (Control of the major (labelled) tics on all axes at once is possible with set tics) http://www.gnuplot.info/docs/node270.html
set mxtics (Minor tic marks along the x axis are controlled by set mxtics) http://www.gnuplot.info/docs/node205.html
set mytics (Minor tic marks along the y axis are controlled by set mytics) http://www.gnuplot.info/docs/node205.html
Examples:
set mxtics 4|
Shows four minor tics per major tic.
set y2tics mirror|
Copies the tics and numbers from the left y-axis to the right.

Label Options:
The set xlabel command sets the x axis label. Similar commands set labels on the other axes.
set xlabel http://www.gnuplot.info/docs/node292.html
Examples:
set ylabel "mm/h"|
This sets the label of the Y1 axis
set y2label "mm"|
This sets the label of the Y2 axis

Format:
The format of the tic-mark labels can be set with the set format command.
set format http://www.gnuplot.info/docs/node182.html
Examples:
set format x "%d.%m"|
This shows the day and month under the major tics. To know, which placeholders you can use see the timefmt command: http://www.gnuplot.info/docs/node274.html

Grid:
With the grid command you can change the display of the grid.
set grid http://www.gnuplot.info/docs/node188.html
Examples:
set grid nomxtics|
This do not display gridlines for the minor tics, only the major ones.
set grid noxtics|
This is the opposite of the example above: only the minor tic grid is drawn, the major tics are not.

Linestyles:
Use the set style line command to change the linestyles:
set style line http://www.gnuplot.info/docs/node237.html#linestyle
Examples:
set style line 1 lw 10| set style increment user|
This sets the first line to a linewidth of 10 (!)
set style line 1 lw 2| set style line 2 lw 2|set style increment user|
For every additional line you have in a graph, you need to add an extra set style line [n lw 2] into the code (where n increments up by one each time)
set style line 1 lt 0| set style increment user|
Produces a grey dashed line

Key Options:
The set key enables a key (or legend) describing plots on a plot.
set key http://www.gnuplot.info/docs/node192.html
Examples:
set key below box|
This set the key below the graphic and draws a box around it

Timestamp:
With the timestamp command you can put in the top or bottom left corner a timestamp.:
set timestamp http://www.gnuplot.info/docs/node273.html for all different placeholders see here: http://www.gnuplot.info/docs/node274.html
Examples:
set timestamp "%d.%m.%y - %H:%M"|
Will show: 15.11.09 – 16:53
set timestamp "%d/%m/%Y" top|
Will show: 15/11/2009 on top of the graph

Conclusion:
To sum the above up, I show an example of a format string, which I use in some graphs:
set mxtics 7| set locale "de_DE"| set terminal png transparent 9| set grid nomxtics|
set key below|
The first command is to set a minor tic for every day. The second is to change the date/time to german, the third makes the graph with a transparent background and I need to tell gnuplot again, that the fontsize should be 9pt (otherwise it is overridden) and the fourth says, that there is no grid for the minor tics. Finally the legend is put under the graph (could be in a box, see example at Key Options)