I'm using gnuplot to plot different temperature measurements with a timestamp from a data file like this:
”id";"timestamp";"1";"2";"3";"4";"5";"6";"7";"8";"9";"10";"11";"12";"13";"14";"15";"16";"17";"18";"19";"20";"21";"22";"23";"24"
"925";"2017-02-22 06:49:29";"68";"69";"56";"76";"88";"95";"96";"104";"94";"177";"85";"80";"84";"92";"109";"58";"45";"49";"55";"13620";"132";"105";"54";"57"
"926";"2017-02-22 06:49:34";"69";"68";"56";"76";"89";"95";"97";"104";"95";"177";"85";"79";"84";"92";"117";"58";"125";"49";"56";"13620";"132";"105";"54";"58"
"927";"2017-02-22 06:49:40";"68";"68";"56";"76";"88";"94";"96";"104";"95";"177";"85";"79";"85";"92";"90";"58";"465";"50";"57";"13620";"132";"105";"54";"58"
"928";"2017-02-22 06:49:46";"68";"68";"57";"76";"88";"94";"96";"105";"94";"178";"84";"79";"185";"93";"104";"58";"46";"50";"57";"13620";"132";"105";"54";"58"
"929";"2017-02-22 06:49:52";"69";"69";"56";"76";"88";"94";"96";"105";"94";"178";"84";"80";"185";"93";"104";"58";"46";"50";"57";"13620";"132";"105";"54";"58"
Plotting the temperature against the "id" works fine, but connecting it to the timestamp doesn't work yet. I'm setting the format for the xdate to time and specify the format like this:
set xdata time
set timefmt "\"%Y-%m-%d %H:%M:%S\””
#set xrange ['"2017-02-23 05:00"':'"2017-02-23 17:00"']
set tics font",8"
set link x2
set x2tics format "%d.%m.%Y\n%H:%M" time offset 0,-1
set xtics format ""
For not setting the xrange the plots are looking good but gives me the following,
set xrange [ * : * ] noreverse nowriteback # (currently ["\"1970-01-01 00:15:00??":"\"1970-01-01 03:00:00??"] )
which I would like to change to the actual timestamp from my file. If I set it manually,
set xrange ['"2017-02-23 05:00"':'"2017-02-23 17:00"']
the time on the axis is correct, but no plots.
Plotting the data directly with the timestamp only gives one value, also with the wrong time axis.
I tried to define the x2ticlabels(2) but it didn't worked and gave me an error
plot raw_temperatures_datafilename every ::csvminline::csvmaxline using ($1):($12/10):x2tic(2)
"wrx_temperature1.1.gp", line 68: warning: add_tic_user: list sort error
I tried to figure out how to get it to work but right now I'm just trying the same ideas that don't work over and over again.
Maybe someone had the same problem and found a solution or got some different ways how to find a solution for this?
The gnuplot that I'm using is Version 5.0 patchlevel 5 last modified 2016-10-02
I attached a picture of my current plot.
And here the code that I'm using:
#raw_temperatures_datafilename = './../../../../measuring_data/wrx01_data_20170221x0X/20170221x00/raw_temperatures.csv'
raw_temperatures_datafilename = 'raw_temperatures.csv'
set datafile separator ";"
## 20170221x01 (...6020): Prozessbereich
# csvminline = 500
# csvmaxline = 3300
csvminline = -1
csvmaxline = -1
linewidth = 0.8
set style line 1 lw linewidth lt rgb "#CC0000"
set style line 2 lw linewidth lt rgb "#003399"
set style line 3 lw linewidth lt rgb "#009900"
set style line 4 lw linewidth lt rgb "#000000"
set style line 5 lw linewidth lt rgb "#0099FF"
set style line 6 lw linewidth lt rgb "#CC9900"
# set key autotitle columnhead
# unset key
### output
## use svg
set terminal svg size 1920,1200 fname 'Verdana' fsize 8
set terminal png size 2400,1400 font 'Verdana,8'
set output raw_temperatures_datafilename.'.png'
## use screen
#set terminal wxt size 1800,900 enhanced font 'Verdana,8' persist
set key right top
set key box opaque
set grid
set lmargin 10
set rmargin 10
set multiplot # layout 3,1
set size 1, 0.7
set origin 0, 0.3
set bmargin 0
set title "Temperaturverlauf\n[Temperatur]=grad Celsius"
## first graph
set xdata time
set timefmt "\"%Y-%m-%d %H:%M:%S\""
# set xrange ['"2017-02-23 05:00"':'"2017-02-23 17:00"']
set tics font",8"
set link x2
set x2tics format "%d.%m.%Y\n%H:%M" time offset 0,-1
set format x ""
set yrange [0:550]
set ytics 0,50,500
set ylabel "Reaktor und Prozess"
plot raw_temperatures_datafilename every ::csvminline::csvmaxline using ($1):($12/10) title 'MARTY unten; E17 [10]' with lines ls 1, \
raw_temperatures_datafilename every ::csvminline::csvmaxline using ($1):($23/10) title 'MARTY oben; E10 [21]' with lines ls 2, \
raw_temperatures_datafilename every ::csvminline::csvmaxline using ($1):($11/10) title 'Separator; E16 0x09 [9]' with lines ls 3, \
raw_temperatures_datafilename every ::csvminline::csvmaxline using ($1):($16/10) title 'Separator Zuf¸hrung; E15 0x06 [14]' with lines ls 1, \
raw_temperatures_datafilename every ::csvminline::csvmaxline using ($1):($17/10) title 'Separator Abgang; 0x0D [15]' with lines ls 5, \
raw_temperatures_datafilename every ::csvminline::csvmaxline using ($1):($18/10) title 'Br¸cke; E20 0x29 [16]' with lines ls 4, \
raw_temperatures_datafilename every ::csvminline::csvmaxline using ($1):($3/10) title 'Fackelrohr; E19 0x00 [1]' with lines ls 4
#raw_temperatures_datafilename using ($1):($18/10) title '[16] 0x29 E20 Br¸cke' with lines, \
#raw_temperatures_datafilename using ($1):($3/10) title '[1] 0x00 E19 Fackelrohr' with lines, \
#raw_temperatures_datafilename using ($1):($4/10) title '[2] 0x01' with lines, \
#raw_temperatures_datafilename using ($1):($5/10) title '[3] 0x02' with lines, \
#raw_temperatures_datafilename using ($1):($6/10) title '[4] 0x20' with lines, \
#raw_temperatures_datafilename using ($1):($7/10) title '[5] 0x22' with lines, \
#raw_temperatures_datafilename using ($1):($8/10) title '[6] 0x23' with lines, \
#raw_temperatures_datafilename using ($1):($9/10) title '[7] 0x25' with lines, \
#raw_temperatures_datafilename using ($1):($15/10) title '[13] 0x27' with lines, \
#raw_temperatures_datafilename using ($1):($13/10) title '[11] 0x28' with lines, \
#raw_temperatures_datafilename using ($1):($14/10) title '[12] 0x26' with lines, \
#raw_temperatures_datafilename using ($1):($10/10) title '[8] 0x07 Separator Zuf¸hrung' with lines, \
#raw_temperatures_datafilename using ($1):($21/10) title '[19] 0x0E Eintrag' with lines
#raw_temperatures_datafilename using ($1):($24/10) title '[22] ' with lines
unset x2tics
## second graph
unset title
set size 1.0, 0.15
set origin 0.0, 0.15
set tmargin 0
set yrange [0:240]
set ytics 0,50,220
set ylabel "Prozessgas"
plot raw_temperatures_datafilename every ::csvminline::csvmaxline using ($1):($19/10) title 'Prozessgas ein; 0x10 [17]' with lines ls 1, \
raw_temperatures_datafilename every ::csvminline::csvmaxline using ($1):($20/10) title 'Prozessgas aus; 0x11 [18]' with lines ls 2
## third graph
set bmargin
set size 1.0, 0.15
set origin 0.0, 0.0
set tmargin 0
set xtics format "%H:%M" time
set yrange [0:55]
set ytics (0,10,20,30,40,50)
set ylabel "Kondensation"
plot raw_temperatures_datafilename every ::csvminline::csvmaxline using ($1):($25/10) title 'K¸hlwasser ein; 0x16 [23]' with lines ls 1, \
raw_temperatures_datafilename every ::csvminline::csvmaxline using ($1):($26/10) title 'K¸hlwasser aus; 0x17 [24]' with lines ls 2, \
raw_temperatures_datafilename every ::csvminline::csvmaxline using ($1):($22/10) title 'Sensor K¸hlwasserbeh‰lter; [20]' with lines ls 3
unset multiplot