Reputation: 145
I have this file (x.txt):
0 0 0
0 0 2
2 2 1
0 0 0
which has coordinates of vertexes that should make the triangle.
I want the triangle to be filled. I tried few ways, but didn't succeed:
splot "x.txt" with lines #triangle is not filled
splot "x.txt" with pm3d #I can see only points
set style fill solid
splot "x.txt" with lines #Just lines
I saw few examples on the internet showing how to do it, but none of them worked for my points. Example: http://gnuplot.sourceforge.net/demo/hidden2.html - almost what I want. I want the color not to change and be the same on the whole surface of the triangle.
Upvotes: 1
Views: 2614
Reputation: 48440
If you want to show only this one triangle, you must change your file a bit and use set pm3d ftriangles
. Usually, this is used to draw a smooth boundary if two subsequent scans don't have the same number of points:
File x.txt
:
0 0 0
0 0 2
2 2 1
Plot it with
set pm3d ftriangles
splot 'x.txt' w pm3d notitle
The result with 4.6.3 is:
Upvotes: 1