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 comentarios

Torsten
Torsten el 11 de Ag. de 2026 a las 11:28
Editada: Torsten el 11 de Ag. de 2026 a las 14:11
All AI suggestions failed.
You should ask support for help:
And it will certainly help other users if you post the suggested solution here.
Paul
Paul el 11 de Ag. de 2026 a las 14:53
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.

Iniciar sesión para comentar.

 Respuesta aceptada

Sam Chak
Sam Chak el 11 de Ag. de 2026 a las 15:45
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;

Más respuestas (2)

dpb
dpb el 11 de Ag. de 2026 a las 16:04
Movida: dpb el 11 de Ag. de 2026 a las 16:05
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 comentarios

dpb
dpb el 11 de Ag. de 2026 a las 16:46
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.
Paul
Paul el 11 de Ag. de 2026 a las 16:54
"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 el 11 de Ag. de 2026 a las 18:26
Editada: dpb el 12 de Ag. de 2026 a las 14:02
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.
ADDENDUM: The above would also probably entail there needing to then be an 'UnitsDisplayMode' property for the state of the units label being 'Auto' or 'Manual'

Iniciar sesión para comentar.

Anna
Anna el 17 de Ag. de 2026 a las 7:25
Editada: Torsten el 17 de Ag. de 2026 a las 11:31
Hi,
thanks everybody for help and suggestions.
I have been in contact with support and this is the information I got.
The approach of locating the root locus axis label text objects using “findall” and modifying their “String” properties is no longer a reliable customization method in MATLAB R2026a. In previous releases, this approach could be used to modify the displayed axis labels. In MATLAB R2026a, however, changes made directly to these text objects may be overwritten when the plot is updated. As a result, modifications made through “findall” may not persist consistently. The development team is aware of this behavior, and this enhancement will be considered for a future release.
They suggest a workaround that I share with everybody can need:
sys = tf(1,[1 2 1]);
p = rlocusplot(sys);
removeRootLocusUnitLabels(p);
function removeRootLocusUnitLabels(p)
if nargin < 1 || isempty(p)
p = findall(gcf,'Type','rlocus');
end
for k = 1:numel(p)
fig = ancestor(p(k),'figure');
bg = fig.Color;
if ~isnumeric(bg) || numel(bg) ~= 3
bg = [1 1 1];
end
hideSuffix = sprintf('\\fontsize{0.01}\\color[rgb]{%.4f,%.4f,%.4f}', bg(1), bg(2), bg(3));
p(k).XLabel.Interpreter = 'tex';
p(k).YLabel.Interpreter = 'tex';
p(k).XLabel.String = ['Real Axis' hideSuffix];
p(k).YLabel.String = ['Imaginary Axis' hideSuffix];
end
end
This does not remove the Unit suffix from the chart object itself. Instead, it makes the internally appended suffix very small and the same color as the figure background, so the visible labels appear as: “Real Axis” and “Imaginary Axis”.
If you make additional changes to the plot after this, or if you change the figure background color, please run “removeRootLocusUnitLabels(p)” again after the final plot customization.

2 comentarios

dpb
dpb el 17 de Ag. de 2026 a las 14:42
Editada: dpb el 17 de Ag. de 2026 a las 15:41
Boy! that is klunky, indeed! I think I'd stick with the overlaid axes if twer to be mine.
Did you submit this to Mathworks as an official enhancement request at <Product Support Page>?
Anna
Anna el 18 de Ag. de 2026 a las 6:38
Yes, I have submitted the request

Iniciar sesión para comentar.

Productos

Versión

R2026a

Etiquetas

Preguntada:

el 11 de Ag. de 2026 a las 9:04

Comentada:

el 18 de Ag. de 2026 a las 6:38

Community Treasure Hunt

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

Start Hunting!

Translated by