Page 1 of 1

Gnuplot question

Posted: 2022/05/18 06:59:00
by fiberkill
Hi,
sorry for asking this question, but i'm new in Gnuplot and little confused.

I have a data file (plot_size_transferd.csv) in csv format and a plot file like:

###############################
set title 'Size transfered'
set xlabel 'Date'
set ylabel 'Transfered size (GB)'
set grid x2tics ytics
set datafile separator ";"
set xtics rotate by 90 right out nomirror

set term jpeg enhanced giant size 1024,768
set output 'size_transfered.jpg'

plot "plot_size_transferd.csv" title "CDGSHG" with line lt -1 lw 1 linecolor rgb "blue"
###############################

if i run my gnuplot file i get a graph like you can see in file 'wrong_graph.PNG', but i expect a graph like in 'file expected_graph.PNG', which i created in excel withou any modifications.

can you please explain me, whats wrong whith my plot file ??

Thanks in advance.
FK

Re: Gnuplot question

Posted: 2022/05/20 12:39:42
by jlehtone
The question "How to use Gnuplot?" is not specific to CentOS.
Out of curiosity I did browse gnuplot's own website and got these:

Code: Select all

set ylabel 'Size transfered'
set xlabel 'Date'
set title 'Transfered size (GB)'
set grid x2tics ytics
set datafile separator ";"
set xtics rotate by 90 right out nomirror

set key autotitle columnhead
unset key

set timefmt "%Y.%m.%d-%H:%M:%S"
set xdata time
set format x "%Y.%m.%d"
set term jpeg enhanced giant size 1024,768
set output 'size_transfered.jpg'

plot "plot_size_transferd.csv" using 1:2 title "CDGSHG" with line lt -1 lw 1 linecolor rgb "blue"
Gnuplot was not happy about the header line (columnhead), so found a way to ignore.
The 'timefmt' tells how to read time from file.
The 'xdata time' tells that x-values are time.
The 'plot' had to have 'using 1:2' explicitly.