KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I originally thought this may be the same as gnuplot - start of X series - Stack Overflow - but I think this is slightly more specific. Since I'm interested in finding the "start of X series", so to speak - I'll try to clarify with an example; say you have this script: # generate data system "cat > ./inline.dat <<EOF\n\ 10.0 1 a 2\n\ 10.2 2 b 2\n\ 10.4 3 a 2\n\ 10.6 4 b 2\n\ 10.8 5 c 7\n\ 11.0 5 c 7\n\ EOF\n" # ranges set yrange [0:8] set xrange [0:11.5] plot "inline.dat" using 1:2 with impulses linewidth 2 If you plot it, you'll notice the data starts from 10 on x-axis: Now, of course you can adjust the xrange - but sometimes you're interested in "relative positions" which start "from 0", so to speak. Therefore, one would like to see the data "moved left" on the x-axis, so it starts at 0. Since we know the data starts at 10.0, we could subtract that from first column explicitly: plot "inline.dat" using ($1-10.0):2 with impulses linewidth 2 ... and that basically does the trick. But say you don't want to specify the "10.0" explicitly in the plot command above; then - knowing that it is the first element of the first column of the data which is already loaded, one would hope there is a way to somehow read this value in a variable - say, with something like the following pseudocode: varval = "inline.dat"(1,1) # get first element of first column in variable plot "inline.dat" using ($1-varval):2 with impulses linewidth 2 ... and with something like this, one wouldn't have to specify this "x offset" value, so to speak, manually in the plot command. So - to rephrase - is there a way to read the start of x series (the first value of a g
Tags (comma-separated)
Save Edits
Cancel