【发布时间】:2015-03-08 00:01:41
【问题描述】:
我有一个程序,它使用几个输入参数生成数据并将其输出到标准输出,我将此数据通过管道传输到 gnuplot 并绘制它(在我的情况下,我没有中间文件):
$ cat sample_data.dat | gnuplot plot_script.gp
sample_data.dat:
0 0.5000
1 0.9225
2 0.2638
3 0.7166
4 0.7492
plot_script.gp
#!/usr/bin/gnuplot
set terminal wxt size 700,524 enhanced font 'Verdana,10' persist
set style line 1 lc rgb '#0060ad' pt 7 lt 1 lw 0.5 # circle blue thin line
set style line 2 lc rgb '#949599' lt 1 lw 1 # --- grey
plot "<cat" using 1:2 w lp ls 1 notitle
我想要完成的事情是这样的
plot "<cat" using 1:2 w l ls 2 notitle, \
"" using 1:2 w p ls 1 notitle
也就是说,我想要一种颜色的线和另一种颜色的点。我只是想办法解决这个问题。
我可以将标准输入读入一个变量来存储它,以便我可以绘制两次吗?
关于 stackoverflow 有一些很接近的问题,但没有什么我可以真正用来解决我的问题, gnuplot-plot-two-data-set-from-stdin 和 pipe-plot-data-to-gnuplot-script
编辑:
我现在也试过了:
plot for[col=2:3] "<awk '{print $1,$2,$2}'" using 1:col w lp ls col notitle
【问题讨论】: