Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
78 views
in Technique[技术] by (71.8m points)

How to generate an gnuplot with coordenates and without creating a file?

I want to create a graph with some coordenates and then line them up. for example: 1; 3 / 2; 4 / 4; 5 but without creating a file with that information. Can i plot the coordenates?

# To view in X:
# To print on a PostScript printer:
set terminal png
set output "graph.png"


set title "Teste Plot"
set xlabel "t"
set ylabel "nt batatas"

set xrange [0:10]
set yrange [0:10]

1, 3
2, 4
4, 5

# Plot
plot "-" with linespoints
question from:https://stackoverflow.com/questions/65847452/how-to-generate-an-gnuplot-with-coordenates-and-without-creating-a-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Check help inline or help special-filenames... well, documentation does not seem to contain an example for plot "-"... maybe somewhere hidden...

Try the following:

Code:

reset session
set title "Teste Plot"
set xlabel "t"
set ylabel "nt batatas"

set xrange [0:10]
set yrange [0:10]
set datafile separator comma

# Plot
plot "-" with linespoints title "my inline data"
1, 3
2, 4
4, 5
e

or (I would prefer this way):

reset session

$Data <<EOD
1, 3
2, 4
4, 5
EOD

set title "Teste Plot"
set xlabel "t"
set ylabel "nt batatas"

set xrange [0:10]
set yrange [0:10]
set datafile separator comma

# Plot
plot $Data u 1:2 with linespoints title "my inline data"

Result:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...