1
votes

I have a data file with a single column of data. By default, gnuplot renders this on the x-axis from left to right. However, I want to plot this data vertically from top to bottom. How can I do this?

The relevant excerpt from my plot file:

set size 1.0, 1.0
set terminal postscript eps enhanced color dashed lw 1 "Helvetica" 14                                                      
set output "ocean-diffuse.eps"

set autoscale
set xtic auto
set ytic auto
plot '0000086400.dat' using 1 with line, \
     '0000172800.dat' using 1 with line
1
can you show us what you've tried so far (the code)? - Paul H
I've added the plot file but I've not yet found anything in the gnuplot documentation that might help me. I'll keep looking. - hertzsprung
the plot command assumes your file has x-values in the first column, and y-values in the second. so one option would be to swap the data in your files. - Paul H
But I only have one column of data (which gnuplot is plotting as y values) - hertzsprung
Do you mean plot '0000086400.dat' using 1:0? That uses your single column as x-values and the row number as y-value. - Christoph

1 Answers

2
votes

In order to have the single column used as x-value, use:

plot '0000086400.dat' using 1:0

That uses the row number (column 0) as y-values. Of course you can do any scaling and computation with the row number as

f(x) = x
plot '0000086400.dat' using 1:(f($0))

To have the y-axis reversed, use

set yrange [*:*] reverse