Splitting an axis into a linear and log scale
Show older comments
Hi,
I'm interested in splitting the x-axis of a plot into a linear section and a log section. For example, I want to plot -1 to 20 on a linear scale then switch to a log scale for 20 to 4500 on the same axis. I've looked into functions like semilog and plotxx, and log log, but I can't find anything that allows me to split the axis into two separate scales.
Thanks a lot, Charles
Accepted Answer
More Answers (1)
Youssef Khmou
on 20 Jun 2013
Edited: Youssef Khmou
on 20 Jun 2013
hi Senaasa,
There must a sophisticated way to produce such arrangement, that method is used in many papers related to geophysics, however i propose to you a manual way to try :
Let us consider the problem that we want represent a sinusoidal function on N=600 points such as 230 is limit between the linear and log scales,
N=600;
T=400; % Number of points on the first interval
x1=linspace(0,230,T);
TT=(N-230)*T/230;
x2=logspace(230,N,TT);
x=[x1 x2];
y=sin(2*pi*x*0.025); % frequency of 0.25Hz
Now the most important part, is to use the plot command without the x axis, if you add the x axis, that will create an entropy in the figure :
figure, plot(y);
title(' Linear AND logarithmic scales merged, break point =230' );
Categories
Find more on Line 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!