linux - gnuplot 不能通过 ssh 命令工作

标签 linux ssh plot gnuplot

所以我有一个 csv,还有一个 plt 文件。我运行 gnuplot plt-file.plt 并生成一个 png。

但是如果我运行 ssh sameuser@samemachine 'gnuplot plt-file.plt' 我会收到 pngcario 错误。

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

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

最后说明:我已经使用 png 标志编译了 gnuplot。我只需要任何一种标准图像格式。

最佳答案

这意味着,当您使用 ssh 登录时,可能找不到您自己编译的 gnuplot。在这两种情况下键入 which gnuplot 以查看使用了哪个二进制文件。

通常在使用 ssh 时,您会得到一个非交互式 shell,它提供不同的配置文件,并且具有与登录 shell 不同的环境变量,参见例如Why does an SSH remote command get fewer environment variables then when run manually? .

因此您可以更改相应的配置文件(使用哪些配置文件,取决于您的发行版),或者您可以使用 gnuplot 二进制文件的完整路径。

关于linux - gnuplot 不能通过 ssh 命令工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23939822/

相关文章:

java - 访问属性文件 : Java and Linux

linux - 如何在 Azure Linux 应用服务上托管的应用中打开端口

python - mac 上的 ssh -X 在 matplotlib 中给出错误

linux - Docker 从多个容器挂载到循环设备不工作 只有一个容器可以挂载

linux - 将文件从 My_Pc 上传到远程 Linux 服务器而不是 ftp Vb.Net

ssh - 如何将我自己的公钥添加到 Vagrant VM?

php - 无法调用 ssh2_connect() 回调

R 在文本标签周围绘制 : Is there a way to draw a border, 阴影或缓冲区?

python - 删除 pandas.plot 中的标题子图

r - 如何在 ggplot2 中添加 abline,x 轴为年份?