feeling
feeling

Reputation: 53

Gnuplot two x-axis from different files

I want to plot data in a plot with two different x-axes. One should be Time in years the other one time in MJD. This is an example from file 1 (x in years):

    2011.27466   0.012
    2011.71704   0.019
    2011.71716   0.021
    2011.87012   0.045

This is an example from file 2 (x in MJD):

   -654.25226   0.012
   -654.25177   0.019
   -492.64032   0.021
   -436.78577   0.045

Y-Values are (of course) the same. How do I get a plot of this with x in years on the bottom and x in MJD on the top?

Upvotes: 0

Views: 2431

Answers (1)

Christoph
Christoph

Reputation: 48440

Use axes x2y1 to use the second, top axis:

set xlabel 'Time (in years)'
set x2label 'Time (in MJD)'
set xtics nomirror
set x2tics
plot 'file1.txt' using 1:2, 'file2.txt' using 1:2 axes x2y1

Upvotes: 1

Related Questions