How do I plot a second axis which scales with the inverse of the original axis?

17 views (last 30 days)
I'm creating an Arrhenius plot. The x-axis of the Arrhenius plot is 10,000/T in Kelvin. Rarely has there been a less intuitive axis. I want to add a second x-axis which plots temperature in Celsius, which would line up with the values in 10,000/T(K).
The problem here is that the second x-axis needs to scale with the inverse of the original. This is not a linear scale, or a log scale, but a 1/x scale. How do I do this?
So far I have been using addsecondaxis, here is the script which will approximate a second linear x-axis:
axes = gca; % get current axis data
Clim = 10000./axes.XLim - 273.15; % converts the current X axis limits to Celsius in a 1x2 vector
Clim = wrev(Clim); % reverses the vector so that addsecondaxis() won't break
addsecondaxis(Clim); % adds another axis at the top with degrees C
set(gca,'XDir','Reverse'); xlabel('Temperature (°C)') % labels/reverses the T(C) axis
Now I just need a way to get the axis to scale as 1/x rather than linear. Any help would be greatly appreciated.
Using 2014b.

Accepted Answer

Star Strider
Star Strider on 6 Mar 2015
I’m having a bit of a problem following your code, but you can label your second axis with whatever you want using set with gca and 'XTick' and 'XTickLabel'.
For example:
set(gca, 'XTick', axes.XLim, 'XTickLabel', Clim)
I’m not certain that’s exactly what you want, so experiment with it since I may have misunderstood your variables.
  4 Comments
Star Strider
Star Strider on 7 Mar 2015
My pleasure! And thank you for the compliment!
Happy kinetic studies! My B.S. was in Chemistry, but back in the phlogiston days.

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!