Tomas Aschan
Tomas Aschan

Reputation: 60564

Gnuplot: plot data from command

I know I can plot with data from stdin by using '-' as the data source, but is there any way I can plot data output from a command the same way? I.e., instead of running the command and piping to the gnuplot script, can I specify the command in the gnuplot script itself?

Something like this (but this doesn't work):

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...

The above makes cmd contain a single long line with all the lines of output smashed together.

Upvotes: 1

Views: 3038

Answers (1)

choroba
choroba

Reputation: 241768

Yes, you can:

plot '< ./mycmd'

Upvotes: 6

Related Questions