I'm now confused by the problem that as I was planning to draw a plot with two x-axis :one for mass in eV and the other for frequency in MHz (Note that 1MHz=6.58×10^(-10) eV is taken here), I can't make it with the following code:

test2 = List[{10^(-8), 10^(20)}, {2*10^(-8), 10^(34)}]
upperTicks2 = 
  Module[{labels, positions}, 
   labels = Range[10^(-9)/6.58*10^(-10), 10^(-7)/6.58*(10^-10), 10]; 
   positions = #/(6.58*10^(-10))&/@labels; Transpose[{positions, labels}]];
ListPlot[test2, Frame -> True, ImageSize -> 600, 
 PlotRange -> {{10^(-9), 10^(-7)}, {0, 10^(35)}}, 
 FrameLabel -> {{"Intensity (a.u.)", " "}, {"Wavelength (nm)", 
    "Energy (eV)"}}, 
 FrameTicks -> {{Automatic, None}, {Automatic, upperTicks2}}]

And my result is enter image description here

Last but not least, my code imitates the example in this link.

Thank for Daniel Huber. I update my code, which I think it will not have the first problem mentioned by Daniel Huber. And the second point mentioned will not a big deal in my care.

I will thank anyone who helped me !

  • 2
    $\begingroup$ Your upperTicks2 are not in the PlotRange. Extend the y plot range to negative values to get the first point right. $\endgroup$ Dec 24, 2022 at 8:46


Your Answer

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

Browse other questions tagged or ask your own question.