org-arl / arlpy

ARL Python Tools
BSD 3-Clause "New" or "Revised" License
119 stars 37 forks source link

feat(plot): added return values to most of the plot.<type> methods to… #25

Closed notthetup closed 5 years ago

notthetup commented 5 years ago

… enable live updating of plots

Returns the GlyphRenderer for each of the types of plots, which can then be used for live changing the plot in real time.

For plot.freqz, a tuple of GlyphRenderers is returned. One for each of the amplitude and phase plots

mchitre commented 5 years ago

The problem with returning the plot is that the user has to put a ";" at the end to avoid printing out what is returned.

The current mechanism is to use gcf() to get the handle to the last figure, so that you can use it to change plot in real-time if needed. Does this not work for your use case?

notthetup commented 5 years ago

Unfortunately, I couldn't find a way to get handles to the GlyphRenderer objects from a Figure object. Or at least I haven't found a way to get them.

mchitre commented 5 years ago

Fair enough. Would it work if we had a similar call as gcf() which returned the GlyphRenderer?

notthetup commented 5 years ago

That's what I was thinking about. Potentially have gcf return an object which has access to both a list of all GlyphRenderer and the Figure too.

mchitre commented 5 years ago

To avoid breaking existing code, perhaps better to go with a new function or something like gcf(renderers=True).