Reputation: 189
Currently, I'm trying to create a 3d parametric graph similar to this:
which can be found here: http://gnuplot.sourceforge.net/demo/surface1.html.
With script here: http://gnuplot.sourceforge.net/demo/surface1.17.gnu
My graph looks like this:
and I'm using this:
set datafile separator ","
set parametric
x0 = 0
x1 = 1
x2 = 2
splot 'January5.csv' u x0:1:3 with lines, 'test.csv' u x1:1:2 with lines
Obviously my graph is lacking in comparison. I really like the ability of the first graph in plotting along the x-axis. I've been trying to replicate this, but have been failing so far.
Upvotes: 1
Views: 5947
Reputation: 29357
You don't really need to rely on parametric
if you just want to plot raw data from a file.
With sample data xyz.txt
that looks like noisy sinusoidal time-series:
1 0 9.43483356296457
1 0.0204081632653061 10.2281885806631
1 0.0408163265306122 10.9377108185805
...
3 0.959183673469388 10.2733398482972
3 0.979591836734694 10.1662011241681
3 1 10.4628112585751
(First column is an integer values coding x locations, 2nd and 3rd columns are for y and z. I appended the R script I used to generate those data at the end.)
I would simply use
splot 'xyz.txt' using 1:2:3 with impulses
where impulses
draws vertical lines from the minimum of z. You can change this bevahior; for example, if you want to start at z=0, you could use
set zrange [-1:12]
set ticslevel 0
zmin = 0
zr(x) = (x==0 ? zmin : x)
splot 'xyz.txt' using 1:2:(zr($3)) with impulses
Note that I used regularly spaced values for y, but that doesn't really matter.
Other variations are possible, of course. Maybe Fence plots with a some-liner or Wall charts might be of further assistance.
R script used to generate xyz.dat
:
n <- 50 # number of observation per sequence
k <- 3 # number of sequences
t <- seq(0, 1, length=n) # sampling rate
xyz <- data.frame(x=rep(1:k, each=n), y=t, z=sin(2*pi*t*2.1)+.25*rnorm(n*k)+10)
write.table(xyz, file="xyz.txt", row.names=FALSE, col.names=FALSE)
Upvotes: 1