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 »

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 »

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 »

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 »

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: 137
Joined: Fri Mar 13, 2009 12:58 am
Location: Reno, Nevada USA
Contact:

Re:Collected Gnuplot commands for Meteohub

Post by d_l »

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 »

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: 137
Joined: Fri Mar 13, 2009 12:58 am
Location: Reno, Nevada USA
Contact:

Re:Collected Gnuplot commands for Meteohub

Post by d_l »

I don't know if tranparent backgrounds are possible with PNG image file (yes it can). 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 transparent crop xffffff xa xb ...

where W = the px width, H = the px height (note the comma between them), and for FS (font size) use font #).
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. The width, height settings over ride those on Meteohub's size of graph line.

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

The value xffffff normally sets background to be white, but the transparent command must over ride it. The xa, xb, etc. set the colors for the other features on the graph as previously described above. The xa, xb, etc. settings are deprecated, but they still seem to work. xa set as xffffff sets the chart's lines (not the plotted lines) and text to be white. I think xb controls the color of the first plotted line(?).

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

See: https://www.tceweather.com/Mt._Rose_Liv ... Live6.html for a revised version of the above graph overlaid on a weather photo. The set commands used to produce the revised solar graph are as follows at the time of this post (I'm still experimenting): set term gif transparent size 230, 230 font 7 crop xffffff xffffff| set format y ""|set format x "%H"|set xlabel "Hour of Day"|set format y2 "%.0f"|set y2label "W/m^2" Note: the time frame is the last 12 hrs aggregated to 5 minutes. The left axis plots impulses and right y-axis plots bars. This seems to fill in the plotted area under the solar curves more completely. The yellow color is set the usual way.

The set commands used to produce the revised wind graph are as follows: set term gif transparent size 200, 200 font 7 crop xffffff xffffff| set format y ""| set key off| set format x "%g"|set xlabel "MPH" Note: the time frame is the last 1 hour aggregated to 5 minutes. The value is Wind speed per direction.

Heavily edited to make the explanations clearer in light of the link changes at http://www.gnuplot.info and showing set commands used to make the graphs.
Last edited by d_l on Fri May 29, 2020 8:42 pm, edited 3 times 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 »

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

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

Re: Collected Gnuplot commands for Meteohub

Post by d_l »

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.

Edited to emphasize that the png transparent MUST be the initial command or it won't work. That was my problem in previous posts.
Last edited by d_l on Mon Jan 06, 2020 2:34 am, edited 2 times in total.

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 »

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 »

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

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

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

Re: Collected Gnuplot commands for Meteohub

Post by d_l »

It is most unfortunate that the http://www.gnuplot.info website rearranged their links to make Vetinari's collected links broken. I accidentally obliterated some Meteohub graph definitions and started over trying to find a replacement for Vetinari's work. The best that I have found so far is http://www.gnuplot.info/docs_4.4/gnuplot.pdf . I think the 4.4 PDF version is close to Meteohub's gnuplot version. Of course, you will still have to search through the PDF to find the various dispersed gnuplot commands listed at the start of this page.

Terminal gif commands are listed on page 181.
Terminal png commands are listed on page 196.

As far as I can tell, liberal use of certain set commands can over ride the default Meteohub graphic output to produce customized graphs.

User avatar
Napajedlaci.cz
Senior Boarder
Senior Boarder
Posts: 46
Joined: Fri Jul 30, 2010 1:10 pm
Location: Czech republic, Zlin
Contact:

Re: Collected Gnuplot commands for Meteohub

Post by Napajedlaci.cz »

Would it be possible to update gnuplot to a higher version via SSH? This version is very old and the ability to create transparent graphs does not work there :( Even the choice of colors is terrible.
Napajedlaci.cz is very good weather station in Czech republic neer town Zlin.

Post Reply