Gnuplot 版本 5.4 补丁级别 1 : plot several datasets with single title (legend entry)

标签 gnuplot title

我想绘制几条线。但是我希望它们都具有相同的样式并在图例中创建单个条目。

当我使用时

splot '-' with lines

使用这些数据

0.0 0.0 0.0
0.1 0.1 0.1
0.0 0.1 0.0


0.2 0.2 0.2
0.3 0.3 0.3
0.3 0.2 0.3
e

一切都如我所料。同样如预期,任何样式都会应用于所有线条。

但是如果我尝试添加标题

splot '-' with lines title "myTitle"

在图例中为每个生成一个条目。

enter image description here

如何才能有一个图例条目?

[请注意,我需要在数据集之间有两个换行符,因为我想要不同的行而不是网格] [我正在使用 Gnuplot 版本 5.4 补丁级别 1]

谢谢!

最佳答案

在这种情况下,创建重复的键条目是预期更改的意外结果。请参阅Issue #2380 duplicate titles in key 。对于此处绘图命令通过提供带引号的字符串请求标题的特定情况,旧行为将在版本 5.4.2 中恢复 - 即使绘制了多个数据集,您也只能在键中获得单个条目。

仅供引用 - 引入更改是因为现在可以为文件中的每个数据集生成不同的标题。然而,拥有多个完全相同的标题并不是特别有用。预期用途如下所示

plot 'file.dat' using 1:2 title sprintf("Data set %d", column(-2))

其中column(-2)返回该数据集的索引号。在早期的 gnuplot 版本中,您必须显式地迭代索引号

plot for [index=1:*] 'file.dat' using 1:2 title sprintf("Data set %d",index)

关于Gnuplot 版本 5.4 补丁级别 1 : plot several datasets with single title (legend entry),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67104969/

相关文章:

gnuplot - gnuplot 中未定义的 t 变量

gnuplot - 如何绘制可变箭头和可变颜色?

android - Android 上的 "apple-mobile-web-app-title"

HTML:阻止子元素继承父元素的 [title] 属性

ios - self.PresentingViewController.title 是 [null]

matrix - 没有插值的 Gnuplot 矩阵图不起作用

background - Gnuplot - 如何更改按键背景的不透明度?

matrix - 带有图像和 xrange 的绘图矩阵出现问题

iphone - 如何在 iPhone 中设置 Tabbar 集成?

R - 如何将图例标题添加到保存到变量的 levelplot?