change marker size in a pzmap??
Show older comments
How do i change the marker size in a pzmap
set(0,'DefaultLineMarkerSize',12);
this does not effect a pzmap
Answers (2)
Star Strider
on 2 Oct 2016
That doesn’t appear to be an option in any of the pole-zero plots:
H = tf([2 5 1],[1 3 5]);
hpz = pzplot(H);
grid on
opz = getoptions(hpz)
16 Comments
Robert
on 2 Oct 2016
Star Strider
on 2 Oct 2016
You can’t change the marker size!
Robert
on 2 Oct 2016
Star Strider
on 2 Oct 2016
My pleasure!
How did you do it?
I couldn’t when I tried it, either using the set function or structure syntax. The only possibility I can think of would be to overplot them. That would work for the poles but not the zeros.
Walter Roberson
on 2 Oct 2016
set(hpz.allaxes.Children(1).Children, 'MarkerSize', 12)
Star Strider
on 2 Oct 2016
Thank you, Walter!
That obviously never occurred to me.
Star Strider
on 6 Oct 2021
I just spent some time property spelunking in the R2021b version of pzplot and I can find no references to any line objects (that I would expect to be associated with the markers, and would be listed under the various axes field names). They may exist, however I’m not able to find them this afternoon.
.
Thanks Star Strider. I just modified the marker size manually (and other settings) from the "open Property Inspector", click on any marker (pole or zero), then "2X1 Line" colored in blue next to Children on the left. However, I need to do this programmatically. I tried both pzmap and pzplot fucntions.
Walter Roberson
on 7 Oct 2021
H = tf([2 5 1],[1 3 5]);
hpz = pzplot(H);
hpz.Responses.View.PoleCurves.MarkerSize = 12;
hpz.Responses.View.ZeroCurves.MarkerSize = 12;
Star Strider
on 7 Oct 2021
It doesn’t appear to be possible to change them using any of the properties.
Ismaeel
on 7 Oct 2021
Thanks Walter, it works now. How can I find a list of other settings or properties if I want to change? Any link? Thank you very much. Thanks go to Star as well.
Walter Roberson
on 7 Oct 2021
hpz.Responses.View.PoleCurves and hpz.Responses.View.ZeroCurves are each Line objects, and can have all the usual line properties changed.
Ismaeel
on 7 Oct 2021
Thank you very much for the help, Walter.
I don't see "accept answer" probably because I did post the original question; I did not want to open a new question while it had been asked before.
Thanks.
Ismaeel
on 7 Oct 2021
I wish we had something more general so that one can use it for other plots such as Bode, Nichols, Nyquist but apparently there is no such thing.
Walter Roberson
on 8 Oct 2021
H = tf([2 5 1],[1 3 5]);
bode(H)
fig = gcf;
line_for_magnitude = fig.Children(3).Children(1).Children
line_for_phase = fig.Children(2).Children(1).Children
More generally, take the fig Children and ignore the first of them. The rest are numbered in backwards linear order -- an 2 x 2 array of plots would be
5 3
4 2
Another way of thinking of this is that the plots are drawn down the columns, left to right, just like normal linear ordering for arrays, but as is usual for MATLAB graphics, the most recently drawn object is at the top of the Children list.
Enrico Fioresi
on 17 Jul 2023
Edited: Enrico Fioresi
on 17 Jul 2023
I maybe found another workaround.
ChatGPT aided me, so, I don't know reliable it is. However, it works with rlocus and rlocusplot, so it maybe also works for pzmap.
% Get the handle to the current plot
hAx = gca;
% Set the marker size for poles and zeros
markerSize = 10; % Set the desired marker size
% Get the handles to the poles and zeros markers
hMarkers = findobj(hAx, 'Type', 'line');
% Loop through each marker and set the marker size for poles and zeros
for i = 1:numel(hMarkers)
if any(hMarkers(i).XData) % Check if the marker represents a pole or zero
set(hMarkers(i), 'MarkerSize', markerSize); % change size
end
end
Similarly, the color can be changed.
% Loop through each marker and set the marker size and color for poles and zeros
for i = 1:numel(hMarkers)
if any(hMarkers(i).XData) % Check if the marker represents a pole or zero
set(hMarkers(i), 'MarkerSize', markerSize); % change size
if any(hMarkers(i).YData > 0) % Check if it is a pole marker
set(hMarkers(i), 'MarkerEdgeColor', [0.16 0.73 0.94]); % change color
else
set(hMarkers(i), 'MarkerEdgeColor', [0.78 0.09 0.09]); % change color
end
end
end
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!