RedDragon
RedDragon

Reputation: 25

plot other program's stdout directly with gnuplot

I would like to plot directly from other program stdout. I have found - should be applied to signal data is piped; but how to do that?

./DVM -l 1 -O 1 | gnuplot -p

Upvotes: 1

Views: 538

Answers (2)

Szczerba
Szczerba

Reputation: 283

If I understand correctly you have script that is generating some output that you want to use in your plot like:

$ ls
script.sh

$ cat script.sh 
#! /bin/bash

echo "1 1"
echo "2 3"
echo "5 5"

You can pass its output as a data to gnuplot with command:

./script.sh | gnuplot -p -e "plot '<cat' w l"

Edit: After taking a look in Ethan's answer I realised that you can use '-' insteal of '<cat'.

The output will look like: gnuplot chart

Upvotes: 0

Ethan
Ethan

Reputation: 15118

I have no idea what ./DVM will produce, but if it is emitting gnuplot commands that should work as shown. If it is emitting only data values then you still need a source of gnuplot commands from somewhere, maybe as part of the gnuplot command, maybe from a separate file. That may be the mechanism referred to by your previous advice "- should be applied". For example to execute a simple gnuplot command that plots input [x,y] values:

yourcommand | gnuplot -p -e "plot '-' with lines"

Upvotes: 3

Related Questions