【问题标题】:Gnuplot: plot data from commandGnuplot:从命令绘制数据
【发布时间】:2013-05-11 11:14:08
【问题描述】:

我知道我可以使用'-' 作为数据源来绘制来自stdin 的数据,但是有什么方法可以以相同的方式绘制命令的数据输出?即,我可以在 gnuplot 脚本本身中指定命令,而不是运行命令和管道到 gnuplot 脚本吗?

类似这样的东西(但这不起作用):

set terminal pngcairo
set output 'test.png'

cmd = "`./mycmd`" # running ./mycmd in terminal gives my data to stdout.
                  # the command can be several other commands, piped together.
                  # i'm only interested in whatever comes to stdout after running
                  # the entire thing.

plot cmd u 2:3 w lines # etc...

以上内容使cmd 包含一个长行,所有输出行都被粉碎在一起。

【问题讨论】:

    标签: gnuplot


    【解决方案1】:

    是的,您可以:

    plot '< ./mycmd'
    

    【讨论】:

    • 太棒了!它总是比你想象的要容易 =)
    • @TomasLycken:应该可以。也许您的数据(标题)的第 1 行有问题?
    • 我再次尝试从文件重定向和绘图,但由于某种原因它现在不起作用 - 这就是我删除评论的原因。将进一步调查...
    • 这个问题是无关的——而且很愚蠢。我将我的绘图命令编写为“plot thecommand \”,后跟一个换行符和一些不同的命令。我注释掉了其中的第一个,但 gnuplot 无法处理行间带有 cmets 的转义换行符。谢谢!
    猜你喜欢
    • 2016-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-16
    相关资源
    最近更新 更多