Axes label in root locus

When I draw a root locus, the label for the axes appear as:
Real Axis (seconds^-1)
Imaginay Axis (seconds^-1)
I'd like to remove (seconds^-1).
I used to have the commands:
axIm = findall(gcf,'String','Imaginary Axis (seconds^{-1})');
axRe = findall(gcf,'String','Real Axis (seconds^{-1})');
set(axIm,'String','Imaginary Axis');
set(axRe,'String','Real Axis');
that worked well but now with R2026a does not work any more.

2 Comments

Torsten
Torsten about 3 hours ago
Edited: Torsten about 1 hour ago
All AI suggestions failed.
You should ask support for help:
And it will certainly help other users if you post the suggested solution here.
As of R2024b, rlocus actually generates an rlocusplot. AFAICT from the doc, one can easily change the text part of the axis labels of an rlocusplot but not the "seconds^-1" part, other than changing the time units. Will be curious to see if there is, in fact, a simple answer to this question.

Sign in to comment.

Answers (2)

This is not a solution to the R2026a labeling issue with rlocus or rlocusplot, but rather a primitive math approach (or workaround) from the days at the uni, when students didn't yet have the Control System Toolbox.
rlocus() approach:
sys = tf(4, [1 2 3 4]);
figure
rlocus(sys)
Alternative approach:
% Define range for the gain parameter K
K_vector = linspace(0, 200, 2001);
figure;
hold on;
% Loop through each gain value to compute shifting poles
for i = 1:length(K_vector)
K = K_vector(i);
% Updated characteristic polynomial: s^3 + 2s^2 + 3s + (4 + 4*K)
char_poly = [1, 2, 3, 4 + 4*K];
% current roots at this specific gain
current_roots = roots(char_poly);
% Plot the roots on the complex plane
plot(real(current_roots), imag(current_roots), 'b.', 'MarkerSize', 3);
end
% Format the graph
grid on;
xlabel('Real Axis (\sigma)');
ylabel('Imaginary Axis (j\omega)');
title('Root Locus for 4 / (s^3 + 2s^2 + 3s + 4)');
% Align the axes tightly at the origin
ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
axis([-10 4 -8 8]);
hold off;
dpb
dpb about 3 hours ago
Moved: dpb about 3 hours ago
The custom graphics object limitations stike again -- it seems as though MathWorks will never learn they can't predict what users will want/need to be able to customize.
But, at least in this case, they do allow one to set hold and add an additional overlaid axes via the tiledlayout subtrefuge. I did have to empirically adjust the postions of the secondary axes labels owing to the custom spacing of the plot object -- using the default axes positions instead of rlp.Position creates the second axes that doesn't quite overlay the other exactly and the label positions are in scale of the axes units -- oh! maybe that would be the fixup--set the new axes limits to match. I didn't try that here...
sys = tf([2 5 1],[1 2 3]);
hTL=tiledlayout(1,1);
hA(1)=nexttile;
rlp = rlocusplot(sys);
rlp.XLabel.Visible='off';
rlp.YLabel.Visible='off';
hold(hA(1),'on');
hA(2)=axes('Position',rlp.Position,'Color','none');
hA(2).XAxis.TickValues=[];
hA(2).YAxis.TickValues=[];
hXL=xlabel(hA(2),'Real Axis');
hXL.Position=hXL.Position+[0 -0.05 0];
hYL=ylabel(hA(2),'Imaginary Axis');
hYL.Position=hYL.Position+[-0.05 0 0];

3 Comments

sys = tf([2 5 1],[1 2 3]);
hTL=tiledlayout(1,1);
hA(1)=nexttile;
rlp = rlocusplot(sys);
rlp.XLabel.Visible='off';
rlp.YLabel.Visible='off';
hold(hA(1),'on');
hA(2)=axes('Position',rlp.Position,'Color','none', ...
'XLim',rlp.XLimits,'YLim',rlp.YLimits );
hA(2).XAxis.TickValues=[];
hA(2).YAxis.TickValues=[];
hXL=xlabel(hA(2),rlp.XLabel.String);
%hXL.Position=hXL.Position+[0 -0.05 0];
hYL=ylabel(hA(2),rlp.YLabel.String);
%hYL.Position=hYL.Position+[-0.05 0 0];
xlim(hA(2)), ylim(hA(2))
ans = 1×2
-2.5000 0.5000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
ans = 1×2
-1.5000 1.5000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Well, the label positions aren't fixed by setting the axes limits; will have to continue to move them arbitrarily to avoid the rootlocus plot tick labels.
"it seems as though MathWorks will never learn they can't predict what users will want/need to be able to customize."
Anyone who follows this forum knows that (some?, most?) users want to have maximum control over all aspects of graphics.
In this particular case, it is beyond comprehension as to why the user cannot easily have complete control over the axis labels (assuming that's actually the case).
dpb
dpb about 1 hour ago
Edited: dpb 40 minutes ago
I've railed about the increasing opaqueness of the custom graphics objects since their initial inception. In <Question About Heatmap> I made <my usual comments> to which @Steven Lord made a well considered response (would you expect anything less :>)) that it's a balance between complexity and ease of use. My position there was and remains that if the underlying axes handle(s) were not hidden from the user, then it would be possible to make almost any reasonable enhancement desired by being able to get to those properties that may not have been made expressly visible. Secondarily, the ability to overlay a second axes would allow for other features not anticipated by the original designers to be displayed; some won't even allow that.
In this particular case, given that the split to generate the units text independently of the label text has already been made, the best solution would probably be to simply add a 'Visible' property for it independent of the label. It could default to track but be settable independently by the user. I guess the one gotcha' is the position would need to be adjusted to retain centering of the displayed label.

Sign in to comment.

Products

Release

R2026a

Tags

Asked:

on 11 Aug 2026 at 9:04

Edited:

dpb
about 17 hours ago

Community Treasure Hunt

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

Start Hunting!