How Do I, in Gnuplot, Make a 3d Chart Where the filename is ztics

53 Views Asked by At

Just like the title sounds...

I have some number of files where the filename are the year of the data set represented.

I would also like to use the first column as text for the x axis, second column as the y. The first row as label information...

set datafile separator ","
filelist=system("ls")
ztics=list
splot for [i=1:words(list)] word(list,i) using 0:1:list with lines

I tried the previous code with no luck and I'm not exactly sure I understand the syntax of Gnuplot

A bit of the file format I'm using:

Source,Count
Foo,8452
Bar,8304

I want to use the filename to track changes over some dates.

1

There are 1 best solutions below

0
On

"I would like to use the filename as a date stamp on a axis. The first column I would like to treat as text and the second column as value of the text."

OK. We use the filename as a title and title at beginning places it on the y axis at the start of that plot. I added a bunch of spaces at the end of the filename to shift it left so that it would not sit on top of the first label.

using 0:2:1 with labels uses the line number in the file as the x coordinate, uses the 2nd column as the value, and the 1st column as a text label.

I plot the data as lines also, so you can see which line the label belongs to.

file1.dat
  A  2
  B  1
  C  3
file2.dat
  E  4
  F  2
  G  3

gnuplot script

set border 3
set tics scale 0
set style textbox opaque
set xrange [0:5]
set yrange [0:5]
set ytics (0, 2.5, 5)
filelist = system("ls -1")
plot for [FILE in filelist] FILE using 0:2 with lines title FILE."      " at beginning, \
     for [FILE in filelist] FILE using 0:2:1 with labels boxed notitle

enter image description here

But this may not be what you really want, because you referred to a 3D plot and a z axis. Also if two labels end up at the same [x,y] you only see one of them; perhaps that isn't a problem for your actual data. If it's too far from what you really want to help, perhaps you can give a link to a plot (could be from anywhere) that more or less looks like what you have in mind.