gnuplot plot labelled data

别等时光非礼了梦想. 提交于 2019-11-30 18:00:58

You can do this with the following command:

set datafile sep ','
plot 'test.dat' u 2:3:1 w labels point offset character 0,character 1 tc rgb "blue"

Part of your confusion is probably gnuplot's shorthand notation for a lot of things. For example, in the command above, u stands for using and w stands for with and tc stands for textcolor. In general, gnuplot allows you to shorten a command to the shortest unique sequence of characters that can be used to identify it. so with can be w,wi,wit and gnuplot will recognize any of them since no other plot specifiers start with w.

The numbers after the using specifier are columns in your datafile. So here, the x position of the label is taken from the 2nd column. The y position is taken from the 3rd column. And the label text is taken from the 1st column which is where we get the using 2:3:1. It's actually a lot more powerful than that (the syntax will allow you to add 2 columns together to derive an x or y position for instance), but explaining all of that should probably be left for another question.

Since you are using a csv file you should set the separator:

set datafile separator ','

Also, I think this is what you're trying to do:

plot 'infile' using 2:3, 'infile' 2:3:1 with labels offset 1
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!