- #1
CAF123
Gold Member
- 2,948
- 88
I am trying to link the upper axis with the lower axis in gnu plot, that is print out values on the upper axis given a relationship between the upper axis, x2, quantities and the lower axis, x, ones. The relationship between them is
with
The following should be sufficient
I've also log formatted the x-axis via
but regardless of whether I include the log formatting I am unable to get any meanginful values printed out on the upper axis. (The function for y is for illustrative purposes only, the value for y in my actual script relies on reading in data from a file)
I'd like to print out values on the upper axis for two values of x=100, 1000 say. Not sure if this is the right place for this but thanks for any comments!
Code:
x2 = 2*c**2/(2*x**2-c**2)
Code:
c=3.1
Code:
set xlabel "Quantity lower"
set xtics nomirror
set x2label "Quantity Upper"
set x2tics nomirror
set link x2 via 2*(3.1)**2/(2*x**2-(3.1)**2) inverse sqrt((3.1)**2*(2+x)/2/x)
#set link x via 1239.8/x inverse 1239.8/x
set ylabel "Quantity y"
set ytics 0.2
set samples 400
Spectrum(x) = exp(-(x-500)**2/(400))
set xrange[30:2000]
set format x2 "%.2f"
plot Spectrum(x) w l title "Spectrum"
I've also log formatted the x-axis via
Code:
set logscale x
set format x "10^{%L}"
but regardless of whether I include the log formatting I am unable to get any meanginful values printed out on the upper axis. (The function for y is for illustrative purposes only, the value for y in my actual script relies on reading in data from a file)
I'd like to print out values on the upper axis for two values of x=100, 1000 say. Not sure if this is the right place for this but thanks for any comments!