sgrid() and zgrid() call matplotlib.pyplot.figure()
See original GitHub issueWhile debugging some code I noticed that examples/pvtol-nested.py was producing a blank figure instead of a pole-zero map that was expected. I chased this down tto the fact that the sgrid() function calls matplotlib.pyplot.figure(). This is in contrast to all other plotting routines and the consequence is that you get a new set of axes. This causes the following code (from examples/pvtol-nested.py) not to work as expected:
figure(10); clf();
(P, Z) = pzmap(T, Plot=True)
print("Closed loop poles and zeros: ", P, Z)
# Gang of Four
figure(11); clf();
gangof4(Hi*Po, Co);
Figure 10, which should have the output of pzmap will be blank since pzmap calls figure() (through sgrid) and creates a new set of axis (figure #11). Figure #11 will then get erased (away goes the pole/zero map) and be replace by the Gang of 4.
Issue Analytics
- State:
- Created 4 years ago
- Comments:24 (24 by maintainers)
Top Results From Across the Web
matplotlib.pyplot.grid — Matplotlib 3.6.2 documentation
The axis is drawn as a unit, so the effective zorder for drawing the grid is determined by the zorder of each axis,...
Read more >Arranging multiple Axes in a Figure - Matplotlib
Specifies the geometry of the grid that a subplot will be placed. The number of rows and number of columns of the grid...
Read more >matplotlib.pyplot.grid — Matplotlib 3.1.2 documentation
The axis is drawn as a unit, so the effective zorder for drawing the grid is determined by the zorder of each axis,...
Read more >matplotlib.pyplot.figure — Matplotlib 3.6.2 documentation
The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations (labels, ticks, etc). Note that layout managers can measurably slow ......
Read more >matplotlib.pyplot.subplot2grid — Matplotlib 3.1.2 documentation
matplotlib.pyplot. subplot2grid (shape, loc, rowspan=1, colspan=1, ... Create an axis at specific location inside a regular grid. ... The following call.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You already mentioned the Pandas way of providing
.plot()methods to the data objects. I would consider this together with kwargs such asax=andgrid='s'to be the most pythonic.If you want to retain the MATLAB way of calling sgrid() after creating the plot, I have added a comment at StackOverflow with another idea to add the grid axis.
Using the pylab API in matplotlib has been deprecated for a reason, though. Likewise python-control should not try to stick to that coding paradigm either.
B.t.w. I haven’t forgotten about this. Had to focus on another project. Hopefully the delay is not impacting the project.