[SOLVED] [GNUplot] Combine plots
by gregors from LinuxQuestions.org on (#6NQ74)
Hi there!
Some years ago I started to log the value on my electricity meter (the thing that tells me how much electricity I consumed [kWh]).
So, as a GNUplot fan I used my log to draw me nice diagrams. The version I'm using so far produces two diagrams on two pages (value on meter, difference to last reading). Example: https://test.szaktilla.de/plot_alt.pdf
Now I want to combine these two curves in one diagram: y1 is for the value from the meter, y2 is for the difference. What I get so far is here: https://test.szaktilla.de/plot_neu.pdf
How can I tell GNUplot to use the scale on the right side for the difference value?
The log file looks like this:
Code:# Datum, Zaehlerstand, Differenz, Summe seit erster Ablesung
01.04.18, 3555, 27, 27
01.05.18, 3570, 15, 42
01.06.18, 3585, 15, 57and my GNUplot script reads:
Code:#!/usr/bin/gnuplot
FN = "/home/gszaktilla/.stromlog/log.txt"
set terminal postscript
set output "/tmp/plot.ps"
set title FN
set timefmt "%d.%m.%y"
set format x "%d.%m.%y"
set xdata time
set xlabel "Datum"
set xtics rotate by -30
set grid
set yrange [3500:7000]
set ytics nomirror
set y2range[0:350]
set y2tics 50
set ylabel "Zaehlerstand [kWh]"
set y2label "monatl. Verbrauch [kWh]"
plot FN using 1:2 notitle with lines lt 1 lc rgb "#000000", \
FN using 1:(3+3500) notitle with lines lt 1 lc rgb "#FFFF00";I hope I could make clear what my goal is.
TIA
Gregor
Some years ago I started to log the value on my electricity meter (the thing that tells me how much electricity I consumed [kWh]).
So, as a GNUplot fan I used my log to draw me nice diagrams. The version I'm using so far produces two diagrams on two pages (value on meter, difference to last reading). Example: https://test.szaktilla.de/plot_alt.pdf
Now I want to combine these two curves in one diagram: y1 is for the value from the meter, y2 is for the difference. What I get so far is here: https://test.szaktilla.de/plot_neu.pdf
How can I tell GNUplot to use the scale on the right side for the difference value?
The log file looks like this:
Code:# Datum, Zaehlerstand, Differenz, Summe seit erster Ablesung
01.04.18, 3555, 27, 27
01.05.18, 3570, 15, 42
01.06.18, 3585, 15, 57and my GNUplot script reads:
Code:#!/usr/bin/gnuplot
FN = "/home/gszaktilla/.stromlog/log.txt"
set terminal postscript
set output "/tmp/plot.ps"
set title FN
set timefmt "%d.%m.%y"
set format x "%d.%m.%y"
set xdata time
set xlabel "Datum"
set xtics rotate by -30
set grid
set yrange [3500:7000]
set ytics nomirror
set y2range[0:350]
set y2tics 50
set ylabel "Zaehlerstand [kWh]"
set y2label "monatl. Verbrauch [kWh]"
plot FN using 1:2 notitle with lines lt 1 lc rgb "#000000", \
FN using 1:(3+3500) notitle with lines lt 1 lc rgb "#FFFF00";I hope I could make clear what my goal is.
TIA
Gregor