How to make a plot with x-axis that has different scales on different specific regions?

3 Ansichten (letzte 30 Tage)
Hi all,
The first below figure is the plot I can make while the second is the example plot that has different scales on x-axis as highlighted yellow.
I would like to make a plot that has different scales on the same axis the same as the example. I would appreciate it if you could provide some suggestion on this matter.
Thank you.

Akzeptierte Antwort

Bjorn Gustavsson
Bjorn Gustavsson am 26 Jun. 2020
Either you can use something like
set(gca,'xscale','log')
if that brings you close enough.
If you want to plot on some other scaling you can do something like this:
x = logspace(-1,3,41); % just some arbitrary points in x-direction
y = x.^.43 + 0.3*x.^1.32;
plot(x.^.5,y);
x4l = logspace(-1,3,9);
for i1 = 1:9,
xStr{i1} = sprintf('%3.1f',x4l(i1));
end
set(gca,'xtick',x4l.^.5,'xticklabel',xStr)
HTH
  1 Kommentar
Chutiphon Moranon
Chutiphon Moranon am 26 Jun. 2020
Thank you so much!. Once reading your reply, I just have noticed that the x-axis of my example is in the form of logarithm. Therefore, I apply semilogx function together with xticks & xticklabels.
Thanks again :).

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by