0

I want to add a triangle between three points in my gnuplot.

I found this code:

set pm3d ftriangles
splot 'x.txt' w pm3d notitle

whereby x.txt contains for instance:

0 0 1
1 1 0
1 0 1

I would like to be able to do embed all of the code in 1 script without having the extra text file, so just together with the splot command. Is this possible? I tried something like this, but it didn't work:

set pm3d ftriangles
splot w pm3d notitle
0 0 1
e
1 1 0
e
1 0 1
e

Sorry for missing some basics in gnuplot...

2 Answers 2

0

You could try a not-so-elegant small shell script:

#!/bin/bash

cat > x.txt << EOF
0 0 1
1 1 0
1 0 1
EOF

gnuplot << GNUPLOT

set pm3d ftriangles
splot 'x.txt' w pm3d notitle

GNUPLOT

rm x.txt
Sign up to request clarification or add additional context in comments.

1 Comment

The thing is, I already have a .plt script which draws a complicated 3d plot and I want to add this to the existing script (without having to have a second file x.txt)
0

this should work:

splot '-' w pm3d notitle
0 0 1
1 1 0
1 0 1
e

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.