So I have a csv, and I have a plt file. I run gnuplot plt-file.plt
and a png is born.
But if I run ssh sameuser@samemachine 'gnuplot plt-file.plt'
I get a pngcario error.
The csv: sar.csv
time, average io writes
4/15/2014 22:28, 6.040546875
4/15/2014 22:28, 7.943100586
4/15/2014 22:29, 8.686162109
4/15/2014 22:29, 7.693891602
4/15/2014 22:30, 8.579804688
4/15/2014 22:30, 7.900537109
The plt:
clear
reset
print "sar"
set terminal pngcairo transparent enhanced font "arial,25" fontscale 1.0 size 1920, 1080
set key outside bottom center box title "sar" enhanced
set key maxrows 4
set key font ",25" spacing 1 samplen 2.9 width 2 height 1
set xlabel "Time (hours)" font ",25"
set ylabel "Utilization (%)" font ",25"
set output "./sar.png"
set title "sar" font ",35"
set datafile separator ","
set timefmt "%Y-%m-%d %H:%M:%S"
set ytics font ",25"
set style line 1 lt 1 lc rgb "red" lw 4
show style line
offset = 0
starting_time = 37824
t0(x)=(offset=($0==0) ? x : offset, x - offset)
plot "./sar.csv" using (t0(timecolumn(1))/3600):2 every ::3 ls 1 t "sar" with lines
Final note: I've compiled gnuplot with the png flag. I just needed any sort of standard image format.
That means, that your self-compiled gnuplot probably isn't found when you log-in with
ssh
. Typewhich gnuplot
in both cases to see which binary is used.Usually when using
ssh
you get a non-interactive shell, which sources different configuration files and has different environmental variables than a login shell, see e.g. Why does an SSH remote command get fewer environment variables then when run manually?.So you can either change the respective configuration files (which ones are used, depends on your distribution), or you can use the full path to the gnuplot binary.