Collected Gnuplot commands for Meteohub

Definitions of graphs you want to share with us

Moderator: Mattk

Post Reply
Vetinari
Junior Boarder
Junior Boarder
Posts: 39
Joined: Tue Aug 11, 2009 9:01 am

Collected Gnuplot commands for Meteohub

Post by Vetinari » Sun Nov 15, 2009 9:43 pm

Gnuplot commands for Meteohub

Date of creation: November 2009
Meteohub version: 4.5i
gnuplot version: ??

First of all I want to thank you Boris for this great software. I really love the graphs created by meteohub using gnuplot.

So I thought, that we can bundle the information about gnuplot and the commands in one thread/file. Here are some information about gnuplot, collected through this board, added with links to the gnuplot-manual and showing some examples.

If someone knows more commands that can be used, please post them, I will add them in this post and the pdf.

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

These commands can be used:
Localization (set locale)
PNG-Options (set terminal png)
Axes (set tics, set xtics, set ytics, set mxtics, set mytics, ...)
Label Options (set xlabel, x2label, ylabel, y2label, zlabel, cblabel)
Format (set format)
Grid (set grid)
Linestyles (set style line)
Key Options (set key)
Timestamp (set timestamp)

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 you 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)

I made it as a pdf: perhaps you can allow pdfs, so I can attach it.

Boris which gnuplot version is in meteohub? 4.2 or 4.3?

rune
Expert Boarder
Expert Boarder
Posts: 104
Joined: Wed Jun 24, 2009 10:51 pm

Re:Collected Gnuplot commands for Meteohub

Post by rune » Sun Nov 15, 2009 10:06 pm

This is very valuable info. Hopefully we can build a long list of examples, so it's easier to change the graphs.

User avatar
WS Grave
Expert Boarder
Expert Boarder
Posts: 90
Joined: Fri Oct 30, 2009 3:42 pm
Location: Grave - the Netherlands
Contact:

Re:Collected Gnuplot commands for Meteohub

Post by WS Grave » Mon Nov 16, 2009 9:24 pm

Much appreciated Vetinari !!
I'm also just discovering these nice graphs.
The sky (your mind) is the limit ;)

A question about the background color.
If you set the bg color, then the whole graph will be in that color. Do you know if it is possible to set only the inner graph instead of the whole graph?

User avatar
HeinrichH
Gold Boarder
Gold Boarder
Posts: 187
Joined: Sun Jan 04, 2009 6:27 pm
Location: Emmen-Netherlands / Panoias-Portugal
Contact:

Re:Collected Gnuplot commands for Meteohub

Post by HeinrichH » Mon Nov 16, 2009 11:25 pm

Vetinari, Thanks for the list. This is also a thing I wanted to do but my time for hobby is limited. See this http://www.meteohub.de/joomla/index.php ... =6321#6321 post for some more examples.
Checking the remote....

User avatar
d_l
Expert Boarder
Expert Boarder
Posts: 131
Joined: Fri Mar 13, 2009 12:58 am
Location: Reno, Nevada USA
Contact:

Re:Collected Gnuplot commands for Meteohub

Post by d_l » Tue Nov 17, 2009 8:29 pm

Thanks, Vetinari. That info was more helpful that the command lists I previously had for meteohub's gnuplot.

Has anyone been able to make the background of a graph transparent with the set term png transparent or set term png transparent xffffff commands so that the graph could be overlain on a photo background and allow the background details to be visible through the graph?

I haven't as yet. Then too, I thought a transparent color was only possible with GIF images.

Vetinari
Junior Boarder
Junior Boarder
Posts: 39
Joined: Tue Aug 11, 2009 9:01 am

Re:Collected Gnuplot commands for Meteohub

Post by Vetinari » Tue Nov 17, 2009 10:15 pm

As I described above, the command:
set terminal png transparent 9|
sets the background to transparent, but the fontsize changed, so I need to adjust it again.
I do not know, if you can then place a picture as the background.
You can try it via css, make the background transparent, create a picture in the same size, place it in a div box around it, perhaps this could work.

<div id="background_image"><img src="your_image.png" /></div>

User avatar
d_l
Expert Boarder
Expert Boarder
Posts: 131
Joined: Fri Mar 13, 2009 12:58 am
Location: Reno, Nevada USA
Contact:

Re:Collected Gnuplot commands for Meteohub

Post by d_l » Sat Nov 21, 2009 3:00 am

I don't know if tranparent backgrounds are possible with PNG image file. I couldn't get them to work, but background transparency is possible with GIF files and the meteohub can produce them.

To make a GIF file, simply use the command:

set term gif size W,H FS crop transparency xffffff xa xb ...

where W = the px width, H = the px height, and FS = the font size.
These values must be re-specified because the terminal gif setting blows out the height and the font size that has been set in the meteohub entry boxes.

Crop trims off any excess blank space around the graph to reduce it to the minimal size.

The value xffffff sets the white background to be the transparent color and the xa, xb, etc. set the colors for the other features on the graph as described above.

I've used the transparent GIF files generated by the meteohub and overlaid them using a table formating method on a background webcamera image by the method described by wfport here: Overlay a webcam shot with weather data from meteohub.

Image
Last edited by d_l on Wed Aug 04, 2010 12:42 am, edited 1 time in total.

meteoshopping
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: Fri May 07, 2010 11:33 am

Re:Collected Gnuplot commands for Meteohub

Post by meteoshopping » Mon May 31, 2010 9:40 pm

Hi
It is possible to add a border around the pic ?

User avatar
d_l
Expert Boarder
Expert Boarder
Posts: 131
Joined: Fri Mar 13, 2009 12:58 am
Location: Reno, Nevada USA
Contact:

Re: Collected Gnuplot commands for Meteohub

Post by d_l » Fri Jul 30, 2010 7:50 pm

Transparent PNG images are possible with the Meteohub! All you need to do is use set term png transparent FS| as the initial command. FS is the font size you desire.

If this new command is added to an existing set of graph commands, you will notice that the resulting graphs are slightly distorted in size and you might have to adjust size and object placement coordinates to compensate.

User avatar
meteo-quimper
Junior Boarder
Junior Boarder
Posts: 20
Joined: Thu Jun 07, 2012 1:13 pm
Location: Quimper - FRance
Contact:

Re: Collected Gnuplot commands for Meteohub

Post by meteo-quimper » Sat Jul 21, 2012 12:56 pm

Hi

Is it possible to add border around the graph image ?

noxx
Fresh Boarder
Fresh Boarder
Posts: 15
Joined: Wed Nov 07, 2012 12:14 pm

Re: Collected Gnuplot commands for Meteohub

Post by noxx » Sun Feb 03, 2013 11:43 pm

The links from the First notice dont work.....

Is ist possible to fill a column with a Color?
TFA Nexus
Meteohub - Iomega iConnect

Post Reply