I have a data file in the following format.
/foo.jsp 1234
/bar.jsp 6653
/foobar.jsp 9986
/bar.jsp 2221
/foo.jsp 5643
I want to plot this file in Gnuplot where the tics on the x axis is taken from the first column and the values on the y axis from the second column. To illustrate I would like the chart to look something like this:
10000 x x
5000 x x x
0 /foo.jsp /bar.jsp /foobar.jsp
Where the x's are the points in the chart.
The best I have managed to do is:
plot "datafile.dat" using 2:xticlabel(1) with points
However, that command repeats the tics for each value in the first column (i.e. I get two /foo.jsp tics on the x axis). I would like there to be one unique tic for each unique string in the first column.
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.
Define a function y=ln(x2). Set the range of x values from -2 to +2 and range of y values from 3 to +3. Show both the axis on the plot. The labels of x axis and y axis be “x values” and “y values” respectively.
Gnuplot can read binary data files. However, adequate information about details of the file format must be given on the command line or extracted from the file itself for a supported binary filetype. In particular, there are two structures for binary files, a matrix binary format and a general binary format.
You can run a script two ways: Type load "scriptname" from within gnuplot. Or, from UNIX, run gnuplot by typing gnuplot scriptname . In this method, gnuplot will exit when your script is finished, so you may want to include PAUSE -1 "Hit any key to continue" as your last line.
I think you should include a column with just the x number, say foo.jsp=1 , bar.jsp=2, etc. and suppose you put this in the first column.
So your datafile would look like:
1 foo.jsp 1234
2 bar.jsp 6653
3 foobar.jsp 9986
2 bar.jsp 2221
1 foo.jsp 5643
Then use:
plot "datafile.dat" using 1:3:xtic(2) with points
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