I have a list to which I append Axes3D plots. Like this:
self.myList.append(self.axes.plot(xValues,
yValues,
zValues,
picker=self.line_picker)[0])
When that line of code runs, the instance returned by the plot() function is stored in the list AND the line is automatically plotted, which is what I want. This code runs on program startup and draws a variable number of lines.
Now what I need to do is this:
When the user checks a checkbox, I want to REPLACE the data that is currently plotted with another set of data. Then, when the user unchecks the checkbox, I want the initial data to be plotted again.
I have no problem with clearing the initial data; I simply do:
self.axes.clear()
self.canvas.draw()
self.axes.mouse_init()
and now I have a blank 3D graph.
How can I re-plot the same data once it is cleared? Can I somehow use the plot instances stored in the list and re-plot them?
My ultimate question is, do I have to re-plot the original plot using the raw data like I did the first time, or can I somehow hide/disable the initial axes and then simply restore it?
Probably the easiest solution is to keep a reference of the items and simply toggle the specific artist’s visible attribute: