gnuplot hide3d:如何更改表面顶部和底部视图的颜色?

问题描述 投票:0回答:1

使用hidden3d绘制曲面时,我得到的曲面顶视图为绿色,底视图为蓝色,这也可以在示例中找到,大多数是相反的方式,顶视图为蓝色,底视图为绿色(为什么是这样) ?)。
我设法改变了线条的颜色,但仅顶部和底部的颜色相同
绘制 '-' 矩阵,其中线条 linecolor '黑色'
如何将绿色和蓝色更改为我想要的值?我进行了很多搜索并找到了一些提示,但无法使其正常工作。一定与线型或设置样式有关??
感谢您的帮助

更新:来源和图片
我通过管道从 C++ 程序控制 gnuplot。以下是相应的控制命令:

  fprintf (gnuplotPipe, "set terminal windows\n");
  fprintf (gnuplotPipe, "set hidden3d\n");
  fprintf (gnuplotPipe, "set title '3D Surface'\n");
  fprintf (gnuplotPipe, "set zrange [0:100]\n");
  fprintf (gnuplotPipe, "set xyplane  at 0\n");
  fprintf (gnuplotPipe, "unset key\n");  // hide the key
  //  fprintf (gnuplotPipe, "splot '-' nonuniform matrix using 1:2:3  with lines linecolor 'black'\n");
  fprintf (gnuplotPipe, "splot '-' nonuniform matrix using 1:2:3  with lines\n");
  fprintf (gnuplotPipe, "\n");

之后我发送这个数组,它是一个 gnuplot 非统一矩阵:

constexpr int32_t surface [y_size + 1][x_size + 1] = {
  {  20,  0, 216, 431, 647, 862, 1078, 1293, 1509, 1724, 1940, 2155, 2371, 2586, 2802, 3017, 3233, 3448, 3664, 3879, 4095},
//    0   1    2    3    4    5     6     7     8     9    10    11  12  13  14  15  16  17  18  19  20
  {   0, 89,  90,  90,  90,  90,   90,   90,   90,   90,   90,   90, 90, 90, 90, 90, 90, 90, 90, 89, 89},
  { 216, 90,  90,  90,  90,  90,   90,   90,   90,   90,   90,   90, 90, 90, 90, 90, 90, 90, 89, 89, 89},
  { 431, 90,  90,  90,  90,  90,   90,   90,   90,   90,   90,   89, 89, 89, 89, 89, 89, 89, 89, 89, 89},
  { 647, 90,  90,  90,  90,  90,   90,   90,   89,   89,   89,   88, 88, 88, 87, 87, 87, 87, 86, 86, 87},
  { 862, 90,  90,  90,  90,  90,   89,   89,   88,   88,   87,   86, 85, 85, 84, 84, 83, 83, 82, 82, 82},
  {1078, 90,  90,  90,  90,  89,   89,   88,   87,   86,   84,   83, 81, 80, 79, 78, 77, 76, 76, 76, 76},
  {1293, 90,  90,  90,  90,  89,   88,   87,   85,   83,   81,   79, 76, 74, 72, 70, 68, 67, 67, 67, 67},
  {1509, 90,  90,  89,  89,  88,   87,   85,   83,   81,   77,   74, 70, 66, 63, 61, 59, 58, 58, 59, 60},
  {1724, 90,  90,  90,  89,  88,   86,   84,   82,   78,   74,   70, 65, 60, 56, 51, 47, 45, 47, 50, 54},
  {1940, 89,  89,  89,  89,  87,   86,   83,   80,   76,   71,   66, 61, 56, 49, 38, 17, 24, 39, 47, 52},
  {2155, 89,  89,  89,  89,  87,   85,   83,   79,   75,   70,   65, 60, 55, 48, 41, 38, 42, 48, 52, 56},
  {2371, 89,  89,  89,  88,  87,   85,   82,   79,   74,   70,   65, 60, 56, 53, 51, 51, 53, 56, 58, 61},
  {2586, 89,  89,  89,  88,  87,   85,   82,   79,   75,   70,   66, 63, 60, 58, 58, 58, 59, 61, 63, 65},
  {2802, 89,  89,  89,  88,  86,   84,   82,   79,   75,   71,   68, 65, 63, 62, 62, 63, 64, 65, 67, 68},
  {3017, 89,  89,  89,  88,  86,   84,   82,   79,   76,   73,   70, 68, 67, 66, 66, 67, 68, 69, 70, 72},
  {3233, 89,  89,  89,  88,  86,   84,   82,   80,   77,   74,   72, 70, 69, 69, 69, 70, 71, 72, 73, 74},
  {3448, 89,  89,  89,  88,  86,   85,   83,   80,   78,   76,   74, 73, 72, 72, 72, 73, 74, 74, 76, 76},
  {3664, 89,  89,  88,  88,  86,   85,   83,   81,   79,   77,   75, 75, 74, 74, 74, 75, 76, 77, 77, 78},
  {3879, 89,  89,  89,  88,  86,   85,   83,   81,   80,   78,   77, 76, 76, 76, 76, 77, 78, 78, 79, 80},
  {4095, 89,  89,  88,  88,  86,   85,   83,   82,   80,   79,   78, 78, 78, 78, 78, 78, 79, 80, 80, 81},
};

我得到了这张照片:

包含“withlines linecolor‘black’”的线两边都是黑色。我想要顶视图蓝色和底视图浅灰色之类的东西。

3d gnuplot surface
1个回答
0
投票

在我看来,这些颜色就像 gnuplot 默认颜色 1(底部)和 2(顶部)。 因此,将这些线型更改为所需的颜色(选中

help linetype
)。

数据:

SO77638353.dat

#  0   1    2    3    4    5     6     7     8     9    10    11    12    13    14    15    16    17    18    19    20
  20,  0, 216, 431, 647, 862, 1078, 1293, 1509, 1724, 1940, 2155, 2371, 2586, 2802, 3017, 3233, 3448, 3664, 3879, 4095
   0, 89,  90,  90,  90,  90,   90,   90,   90,   90,   90,   90,   90,   90,   90,   90,   90,   90,   90,   89,   89
 216, 90,  90,  90,  90,  90,   90,   90,   90,   90,   90,   90,   90,   90,   90,   90,   90,   90,   89,   89,   89
 431, 90,  90,  90,  90,  90,   90,   90,   90,   90,   90,   89,   89,   89,   89,   89,   89,   89,   89,   89,   89
 647, 90,  90,  90,  90,  90,   90,   90,   89,   89,   89,   88,   88,   88,   87,   87,   87,   87,   86,   86,   87
 862, 90,  90,  90,  90,  90,   89,   89,   88,   88,   87,   86,   85,   85,   84,   84,   83,   83,   82,   82,   82
1078, 90,  90,  90,  90,  89,   89,   88,   87,   86,   84,   83,   81,   80,   79,   78,   77,   76,   76,   76,   76
1293, 90,  90,  90,  90,  89,   88,   87,   85,   83,   81,   79,   76,   74,   72,   70,   68,   67,   67,   67,   67
1509, 90,  90,  89,  89,  88,   87,   85,   83,   81,   77,   74,   70,   66,   63,   61,   59,   58,   58,   59,   60
1724, 90,  90,  90,  89,  88,   86,   84,   82,   78,   74,   70,   65,   60,   56,   51,   47,   45,   47,   50,   54
1940, 89,  89,  89,  89,  87,   86,   83,   80,   76,   71,   66,   61,   56,   49,   38,   17,   24,   39,   47,   52
2155, 89,  89,  89,  89,  87,   85,   83,   79,   75,   70,   65,   60,   55,   48,   41,   38,   42,   48,   52,   56
2371, 89,  89,  89,  88,  87,   85,   82,   79,   74,   70,   65,   60,   56,   53,   51,   51,   53,   56,   58,   61
2586, 89,  89,  89,  88,  87,   85,   82,   79,   75,   70,   66,   63,   60,   58,   58,   58,   59,   61,   63,   65
2802, 89,  89,  89,  88,  86,   84,   82,   79,   75,   71,   68,   65,   63,   62,   62,   63,   64,   65,   67,   68
3017, 89,  89,  89,  88,  86,   84,   82,   79,   76,   73,   70,   68,   67,   66,   66,   67,   68,   69,   70,   72
3233, 89,  89,  89,  88,  86,   84,   82,   80,   77,   74,   72,   70,   69,   69,   69,   70,   71,   72,   73,   74
3448, 89,  89,  89,  88,  86,   85,   83,   80,   78,   76,   74,   73,   72,   72,   72,   73,   74,   74,   76,   76
3664, 89,  89,  88,  88,  86,   85,   83,   81,   79,   77,   75,   75,   74,   74,   74,   75,   76,   77,   77,   78
3879, 89,  89,  89,  88,  86,   85,   83,   81,   80,   78,   77,   76,   76,   76,   76,   77,   78,   78,   79,   80
4095, 89,  89,  88,  88,  86,   85,   83,   82,   80,   79,   78,   78,   78,   78,   78,   78,   79,   80,   80,   81

脚本:

### change line color in splot
reset session

FILE = "SO77638353.dat"
set hidden3d

set linetype 1 lc "grey"
set linetype 2 lc "blue"

splot FILE nonuniform matrix u 1:2:3 w l
### end of script

结果:

© www.soinside.com 2019 - 2024. All rights reserved.