JavaCake
JavaCake

Reputation: 4115

Plotting values directly in plot function

Im currently plotting all my data by passing values from an array into a file and reading it.

Is it possible somehow to enter points directly into the plot function?

Something like: plot {{x....}{y....}}

Thanks.

Upvotes: 1

Views: 841

Answers (2)

mgilson
mgilson

Reputation: 309881

This is something that I have had cause to use on occasion...If processing your data is quick, only outputs one dataset and your system supports popen, sometimes it makes sense to have your processing script run as a slave of gnuplot (instead of the other way around). For example:

 #!/usr/bin/env gnuplot
 #This is script is called process_and_plot.gp
 plot "<my_processing_application unprocessed_input.file" u 1:2 w l

In this case you can do your processing and get output in one command: ./process_and_plot.gp ... Of course, this approach is pretty restrictive (passing commandline arguments doesn't really work without some clever tricks, my_processing_application must only write a gnuplot dataset to stdout, etc). In most cases you'll probably want to use @RaphaelRoth's answer, I just wanted to point you toward a slightly different way of thinking about the problem.

Upvotes: 1

Raphael Roth
Raphael Roth

Reputation: 27373

yes that's possible

plot "-" u 1:2 w l
x1 y1
x2 y2
x3 y3
x4 y4
e

Upvotes: 3

Related Questions