如何在Gnuplot中使用不同的点类型指示标签?

如何在Gnuplot中使用不同的点类型指示标签?,gnuplot,Gnuplot,假设我有数据,我想被绘制在一个文件“anives.txt”中: 我可以使用以下方法生成带有标签的散点图: plot "animals.txt" u 2:3:1 w labels 我还可以使用以下方法改变每个点的样式: plot "animals.txt" u 2:3 w points pointtype 3 是否可以让点为每个类别使用不同的点类型或颜色,而不是使用标签(可能重叠)?(例如,使用pointtype 3时,“猫”为红色,“狗”使用pointtype 4时为蓝色,等等) 我可以使用

假设我有数据,我想被绘制在一个文件“anives.txt”中:

我可以使用以下方法生成带有标签的散点图:

plot "animals.txt" u 2:3:1 w labels
我还可以使用以下方法改变每个点的样式:

plot "animals.txt" u 2:3 w points pointtype 3
是否可以让点为每个类别使用不同的点类型或颜色,而不是使用标签(可能重叠)?(例如,使用pointtype 3时,“猫”为红色,“狗”使用pointtype 4时为蓝色,等等)


我可以使用“lc variable”并用颜色替换标签列,但我正在处理的文件有太多不同的标签,我无法轻松做到这一点。

我认为没有直接做到这一点的方法

然而,一个简单的修复方法是使用gnuplot的awk接口。然后,您可以绘制3个单独的图形,每个动物一个

plot "<awk '{ if($1 == \"cat\") print $2,$3  }' animals.dat" u 1:2 w points title "cat", \
     "<awk '{ if($1 == \"dog\") print $2,$3  }' animals.dat" u 1:2 w points title "dog", \
     "<awk '{ if($1 == \"giraffe\") print $2,$3  }' animals.dat" u 1:2 w points title "giraffe"

plot“这只是个天才。
plot "<awk '{ if($1 == \"cat\") print $2,$3  }' animals.dat" u 1:2 w points title "cat", \
     "<awk '{ if($1 == \"dog\") print $2,$3  }' animals.dat" u 1:2 w points title "dog", \
     "<awk '{ if($1 == \"giraffe\") print $2,$3  }' animals.dat" u 1:2 w points title "giraffe"