How can I make the Nichols chart background grid more prominent when using Nicholsplot? (Too faint.)
10 views (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
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.Characteristics
hAx.Responses
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.
0 Comments
More Answers (3)
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?
0 Comments
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.
See Also
Categories
Find more on Plot Customization 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!