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

dorien
  • 5,265
  • 10
  • 57
  • 116

2 Answers2

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
Vinicius Placco
  • 1,683
  • 2
  • 14
  • 24
  • 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) – dorien Aug 25 '16 at 09:47
0

this should work:

splot '-' w pm3d notitle
0 0 1
1 1 0
1 0 1
e
Community
  • 1
  • 1
ewcz
  • 12,819
  • 1
  • 25
  • 47