How can I make the Nichols chart background grid more prominent when using Nicholsplot? (Too faint.)

10 views (last 30 days)
Using a matlab example:
plotoptions = nicholsoptions;
plotoptions.GridColor = [0.0 0.0 0.0];
plotoptions.Grid = 'on';
H = tf([-4 48 -18 250 600],[1 30 282 525 60]);
nicholsplot(H, plotoptions);
Changing the color to black, as above, helps display the dottted nichols chart backgrounfd grid slighly better than the default, but it's still too faint. The default color is [0.15 0.15 0.15]. Is there another setting such as grid transparency (alpha ?) or bold option that would help enhance the grid's "presence" or more bold appearance on the plot?
Thanks.

Accepted Answer

dpb
dpb on 4 Mar 2025
Unfortunately, no. There is no 'Linestyle' exposed property for the grid.
Unfortunately, this is yet another of the contained presentation objects that Mathworks has hidden the underlying axes object so you can't get to it--some have a returned object handle that can be probed to find the underlying components but it appears that this one is totally opaque to the user except for what was chosen to be made visible.
About the only other alternative at the present I hd thought of would be to see if you could set the background color of the axes and find a better contrast with the grid color choice but that's not possible as shown below -- the axes is buried in a composite object that don't have access to.
plotoptions = nicholsoptions;
plotoptions.GridColor = [0.0 0.0 0.0];
plotoptions.Grid = 'on';
H = tf([-4 48 -18 250 600],[1 30 282 525 60]);
nicholsplot(H, plotoptions);
hAx=gca
hAx =
NicholsPlot with properties: Responses: [1x1 controllib.chart.response.NicholsResponse] Characteristics: [1x1 controllib.chart.options.CharacteristicsManager] FrequencyUnit: "rad/s" PhaseUnit: "deg" PhaseWrappingEnabled: off PhaseWrappingBranch: -180 PhaseMatchingEnabled: off PhaseMatchingFrequency: 0 PhaseMatchingValue: 0 MinimumGainEnabled: off MinimumGainValue: 0 Visible: on IOGrouping: "none" InputVisible: on OutputVisible: on Use GET to show all properties
hAx.Characteristics
ans =
CharacteristicsManager with properties: AllStabilityMargins: [1x1 controllib.chart.options.CharacteristicOption] FrequencyPeakResponse: [1x1 controllib.chart.options.CharacteristicOption] MinimumStabilityMargins: [1x1 controllib.chart.options.CharacteristicOption]
hAx.Responses
ans =
(H) SourceData: [1x1 struct] Name: "H" Visible: on LegendDisplay: on Color: [0 0.4470 0.7410] LineStyle: "-" MarkerStyle: "none" LineWidth: 0.5000 MarkerSize: 6
hAx.Responses.LineWidth=5;
shows that the only linestyle one can get to is for the response, not the grid.
Submit enchancement request although that won't help in the immediate future. Red showed up a little better, but is not suitable for quality graphics.

More Answers (3)

Paul
Paul on 5 Mar 2025
You can change the linewidth of the grid lines
plotoptions = nicholsoptions;
plotoptions.GridColor = [0.0 0.0 0.0];
plotoptions.Grid = 'on';
H = tf([-4 48 -18 250 600],[1 30 282 525 60]);
Original plot
figure
N1 = nicholsplot(H, plotoptions);
Why is the -20 dB outside the axes? That looks very strange.
New plot
figure
N2 = nicholsplot(H, plotoptions);
N2.AxesStyle.GridLineWidth = 2;
But doing so changes the limits on the Open-Loop Gain axis?

Andrew Ouellette
Andrew Ouellette on 5 Mar 2025
Hi Charles,
Starting in R2024b, the nicholsplot function returns a chart object with a documented API. You can see the properties of the chart object here: https://www.mathworks.com/help/control/ref/controllib.chart.nicholsplot-properties.html
Specifically, you are interested in the AxesStyle property. You can change the GridColor and GridLineWidth from this property.
h = nicholsplot(tf([-4 48 -18 250 600],[1 30 282 525 60]));
h.AxesStyle.GridVisible = true;
h.AxesStyle.GridColor = [0 0 0];
h.AxesStyle.GridLineWidth = 2;
If you would like to download the R2025a prerelease, you can also change the GridLineStyle and hide/show the labels with GridLabelsVisible.
Unfortunately, there is no way to change the alpha value of the custom grid lines in a nichols chart. If you have not set the GridColor, there is some transparency applied to the grid lines, but that transparency is lost as soon as you manually specify a color.
  1 Comment
Charles
Charles on 5 Mar 2025
Thank you Andrew. Very helpful. Answers most of my questions. I look forward to 2025a with apparently a few more additions as well. Regards, Charles

Sign in to comment.


Charles
Charles on 5 Mar 2025
Also thanks to Paul and DB for your comments as well. Much appreciated.

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!