gnuplot plot labelled data

后端 未结 2 455
南笙
南笙 2021-01-04 09:15

I am new to gnuplot and am having trouble finding the meaning of some of the commands. I want to plot a csv file where the rows are data points and the three columns represe

相关标签:
2条回答
  • 2021-01-04 09:20

    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
    
    0 讨论(0)
  • 2021-01-04 09:24

    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.

    0 讨论(0)
提交回复
热议问题