1

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
6
  • can you show us what you've tried so far (the code)? Commented Jan 21, 2014 at 21:38
  • 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. Commented Jan 21, 2014 at 21:47
  • 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. Commented Jan 21, 2014 at 21:55
  • But I only have one column of data (which gnuplot is plotting as y values) Commented Jan 21, 2014 at 21:55
  • 1
    Do you mean plot '0000086400.dat' using 1:0? That uses your single column as x-values and the row number as y-value. Commented Jan 21, 2014 at 22:15

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

1 Comment

This does the job nicely! Slightly more succinctly, set yrange [] reverse also works for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.