简体   繁体   English

在gnuplot中的线之间着色表面

[英]Colouring the surface between lines in gnuplot

I am making a 3D plot in gnuplot. 我正在gnuplot中制作3D图。 I am drawing three lines that form a triangle in space. 我正在绘制在空间中形成三角形的三条线。 Is there any way to colour of fill the triangle they form? 有什么方法可以填充形成的三角形的颜色吗?

set style line 6 lc rgb 'green' pt 7 ps 6  dt (2,4,2,4) lw 2

set arrow from -0.6666666666666666, 0.3333333333333333, 1.7040257344605167 to 0.20784800000000003, 0.36612, 0.4082358795271838 nohead ls 6
set arrow from 0.20784800000000003, 0.36612, 0.4082358795271838 to 0.3333333333333333, 0.6666666666666666, 0.6085806194501847 nohead ls 6 

set arrow from 0.20784800000000003, 0.36612, 0.4082358795271838 to -0.3333333333333333, 0.6666666666666666, 0.8520128672302584 nohead ls 6 

You can define polygons in gnuplot (for which you can define a fill style). 您可以在gnuplot中定义多边形(可以为其定义填充样式)。 This might solve your problem: 这可能会解决您的问题:

set object 1 polygon from \
    x1, y1, z1 to \
    x2, y2, z2 to \
    x3, y3, z3 to \
    x1, y1, z1

set object 1 fc rgb '#000000' fillstyle solid lw 0

Here is a working example (including your arrows). 这是一个有效的示例(包括您的箭头)。 (I had to modify the coordinates to obtain a closed triangle): (我必须修改坐标以获得一个闭合三角形):

set style line 6 lc rgb 'green' pt 7 ps 6  dt (2,4,2,4) lw 2
x1=-0.6666666666666666
y1=0.3333333333333333
z1=1.7040257344605167
x2=0.20784800000000003
y2=0.36612
z2=0.4082358795271838
x3=0.3333333333333333
y3=0.6666666666666666
z3=0.6085806194501847
set arrow from x1, y1, z1 to x2,y2,z2 nohead ls 6
set arrow from x2,y2,z2 to x3,y3,z3 nohead ls 6 
set arrow from x3,y3,z3 to x1, y1, z1 nohead ls 6 

set object 1 polygon from \
    x1, y1, z1 to \
    x2, y2, z2 to \
    x3, y3, z3 to \
    x1, y1, z1

set object 1 fc rgb '#000000' fillstyle solid lw 0

set xrange[-1:1]
set yrange[-1:1]
set zrange[-1:1]

splot -10:-10:-10

The output looks like this: 输出看起来像这样: 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM