Well, we could keep it simple and just give a hook to custom figures.
If a user wants a custom subplot
def add_my_subplot(self, *args, **kwargs):
Is there any downside to this approach? It seems like if you are
going to the trouble to create a custom figure, you might was well
handle your own custom subplots there rather than in the Figure class
fig = figure(FigureClass=MyFigure)
fsplist = [Subplot(fig,211), Subplot(fig,212), Subplot(fig,211)]
for fsp in fsplist:
You should end up with three subplots, with fsp[-1] and fsp at the same
location 211, when in fact you really need only two subplots (assume that the
last one is an updated version of the first one, which is not obvious in this
example....). In short, the `add_my_subplot` does not reproduce the behaviour
FYI, when I started working on that yesterday evening, I wrote something quite
similar to what you're suggesting. Then, I needed to go through all my
subplots, and instead of checking the `figure.axes` list, I checked
`fig._axstack_elements`. Which was empty, of course. So I added a
`self._axstack.push(MySubplot`) to `add_my_subplot`, then noted that I had to
put back the tests on whether the dubplot was already present or not
(figure._seen), and before soon, I was just copying the basic 'add_subplot()'
around that `self.axes.append(MySubplot)`. As I have several custom figures
with custom subplots, I realized it'd be cleaner to just make a
`add_generic_subplot` instead of copying/pasting most of the code.
I'm realizing now that had I worked on `figure.axes` straight away, I would
never have had the proper behaviour, so I've been lucky.