Graph gets cut-off when adding a new graph
Show older comments
Hello,
I try make a plot with different graphs. The first 5 graphs are constants. The 6th graph is of form of 1/x^2 which should increase exponentially when approaching zero. But at 1*10^-6 sharp it gets cut and the exponentially growing part below 1*10^-6 does not show. How can I prevent, getting exponential increasing plots not cut off? I tried also different varieties of hold on/off and nothing worked. You will find the result attached. Thanks for your help!
Code:
ax = gca; % get the current axis
ax.Clipping = 'off'; % turn clipping off
x=0:0.0000001:0.000002;
tiledlayout(1,1)
ax1 = nexttile;
hold(ax1,'on');
y6=torque_force_05T*(ones(1,length(x))); %blue constant
plot(ax1,x,y6);
y7=torque_force_04T*(ones(1,length(x))); %orange constant
plot(ax1,x,y7);
y8=torque_force_03T*(ones(1,length(x)));%yellow constant
plot(ax1,x,y8);
y9=torque_force_02T*(ones(1,length(x))); %purple constant
plot(ax1,x,y9);
y10=torque_force_01T*(ones(1,length(x))); %green constant
plot(ax1,x,y10);
y1=mu_dynamic*(((Kw*(1000*q)*(1000*q))./(x.^2))+torque_force_05T); %red exponential fuction which gets cut off at 1
plot(ax1,x,y1,'-r')
hold(ax1,'off')
2 Comments
dpb
on 2 Nov 2021
The first hold on causes the symptom by holding the first xy limits when you add the other curves.
Two ways to fix it --
- Set the y axis limits as wanted with ylim when done, or
- Plot the y1 values first before hold on, and then use hold on to keep them.
Valentin Gantenbein
on 2 Nov 2021
Answers (0)
Categories
Find more on Networks 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!