I have a datafile that looks like this
#index name1 name2 name3
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
I want to plot 3 lines:
plot "data" using 1:2 with lines,\
...
This works ok, except for the line labels. How can I specify the column names in the datafile?
I want to use super/subscripts in a text. You can write the supersript as X^2, and the subscript is Y_3. To make several letters super- / sub-script, you need brace like Z_{64}. To use super and subscripts at the same time, try Z@^2_{64}. The following is an example to make legends with the superscripts.
To plot functions simply type: plot [function] at the gnuplot> prompt. Discrete data contained in a file can be displayed by specifying the name of the data file (enclosed in quotes) on the plot or splot command line. Data files should have the data arranged in columns of numbers.
splot is the command for drawing 3-d plots (well, actually projections on a 2-d surface, but you knew that). It can create a plot from functions or a data file in a manner very similar to the plot command. See plot (p. ) for features common to the plot (p. ) command; only differences are discussed in detail here.
If you have gnuplot 4.2 or newer, you can do this fairly easily. You will need to get rid of the comment marker in the first line though.
With a file like this:
index name1 name2 name3
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
the following will do what you want:
set key autotitle columnheader
plot 'a.dat' u 1:2 w l, '' u 1:3 w l, '' u 1:4 w l
If I do set term dumb
before plotting, I get a nice ascii plot. I love gnuplot!
7 ++----------+----------+-----------+-----------+----------+---------$$$
+ + + + + name1$****** +
| $name2 ###### |
| $$$$$$ name3 $$$$$$ |
6 ++ $$$$$$ ###
| $$$$$$ ###### |
| $$$$$$ ###### |
| $$$$$$ ###### |
5 ++ $$$$$ ###### ***
| $$$$$$ ###### ****** |
| $$$$$$ ###### ****** |
| $$$$$$ ###### ****** |
4 $$$ ##### ****** ++
| ###### ****** |
| ###### ****** |
| ###### ****** |
3 ### ***** ++
| ****** |
| ****** |
+ ****** + + + + + +
2 ***---------+----------+-----------+-----------+----------+----------++
1 1.5 2 2.5 3 3.5 4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With