如何使用 gnuplot 保持表面内的颜色调色板相同?

发布于 2025-01-10 03:21:38 字数 443 浏览 0 评论 0原文

我正在绘制一个图表,附上带有 lc 调色板的图(1),它运行良好。但是,当我在其外面设置一个框时,它只会将所有颜色更改为红色。 如何在绘图之外绘制形状,以便绘图不会改变其颜色?

注意:我必须根据晶体形状绘制不同的形状,而不仅仅是立方体。 我有一个包含 4 列的数据文件 (data.dat) 和一个包含三列的第二个文件 (plot.dat)(仅位置) 我正在使用以下命令 splot "data.dat" u 5:6:7:4 with l lw 4 lc 调色板 notitle, "plot.dat" u 1:2:3 wl

[![fig:1[1] 2

I am plotting a graph, attach is fig(1) with the lc palette, It is working well. However, when I am setting a box outside it, it changes all color to red only.
How can I draw shapes outside the plot so that plot does not change its colors?

Note: I have to draw different shapes depending on crystal shapes not only a cube.
I have a data file (data.dat) that has 4 columns and a second file(plot.dat) which has three columns(positions only)
i am using the following command
splot "data.dat" u 5:6:7:4 with l lw 4 lc palette notitle, "plot.dat" u 1:2:3 w l

[![fig:1[1]
2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扮仙女 2025-01-17 03:21:38

调色板中的全部颜色 cbrange 映射到某个特定范围的 z 值。默认情况下,它的范围与图中使用的 z 值相同。因此,在第一个图中,您可以看到绘图的 z 值和调色板的颜色值都从 -0.6 到 +0.6。您的绘图命令 splot "data.dat" u 5:6:7:4 with l lw 4 lc Palette 从第 4 列获取一个值,假设为 0,然后在调色板范围中查找什么颜色映射到。由于 0 位于 cbrange 的中间,因此它会被分配中点颜色。换句话说,颜色条上的 tic 标签告诉您将使用什么颜色范围来映射从第 4 列获取的值。显然,所有第 4 列值都接近零,因为它们的颜色都大致相同。

在第二个图中,您必须从不同的地方获取 z 坐标。不管它是什么,它现在被用来为调色板颜色范围 cbrange 设置不同的默认限制。您可以看到范围已变为 [-0.05 : 0.01],而不是 [-0.6 : 0.6]。如果您想保留与第一个绘图相同的颜色值范围,您所要做的就是显式设置该范围,而不是让程序更改它以匹配一组新的 z 值:

  set cbrange [-0.6 : 0.6]

通常,如果您要绘制一堆对于不同的数据集,并且想要一致的颜色,您可以提前选择 cbrange 并将其设置为所有绘图的颜色。

The full range of colors cbrange in the palette is mapped to some particular range of z-values. By default it gets the same range as the z-values used in the plot. So in your first figure you can see that both the z values of the plot and the color values of the palette run from -0.6 to +0.6. Your plot command splot "data.dat" u 5:6:7:4 with l lw 4 lc palette takes a value from column 4, let's say 0, and looks up in the palette range what color that maps to. Since 0 is right in the middle of the cbrange, it gets assigned the midpoint color. In other words, the tic labels on the color bar tell you what range of colors will be used to map values taken from column 4. Apparently all of your column 4 values are near zero, since they all come out roughly the same color.

In your second plot you must have taken z coordinates from a different place. Whatever it was, it is now being used to set different default limits to the range of palette colors cbrange. You can see that instead of [-0.6 : 0.6] the range has become [-0.05 : 0.01]. If you want to instead keep the same range of color values as your first plot, all you have to do is set that range explicitly rather than letting the program change it to match a new set of z values:

  set cbrange [-0.6 : 0.6]

Typically if you are plotting a bunch of different data sets and want a consistent coloring, you would choose the cbrange in advance and set it to that for all the plots.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文