I am working on image analysis and I want to create an animation of the final results, which includes a time sequence of 2D data and a graph of time sequences on one pixel, so that the 1st graph is updated as the 2D animation progresses. Then install them in the subtitle side by side. The link below contains an image of the final result, which ideally should be animated.

I get the error all the time: AttributeError: the 'list' object does not have the 'set_visible' attribute. I searched for it (like you) and came across http://matplotlib.1069221.n5.nabble.com/Matplotlib-1-1-0-animation-vs-contour-plots-td18703.html , where one guy duck hits by code to set the set_visible attribute. Unfortunately, the plot command does not have such an attribute, so I donโt understand how I can create an animation. I included the monkey patch in the minimum working example below (commented out), as well as the second โim2โ, which is also commented out, which should work for anyone trying to run the code. Obviously, this will give you two 2D plot animations. Minimum working example:
#!/usr/bin/env python import matplotlib.pyplot as plt import matplotlib.animation as anim import numpy as np import types #create image with format (time,x,y) image = np.random.rand(10,10,10) image2 = np.random.rand(10,10,10) #setup figure fig = plt.figure() ax1=fig.add_subplot(1,2,1) ax2=fig.add_subplot(1,2,2) #set up list of images for animation ims=[] for time in xrange(np.shape(image)[1]): im = ax1.imshow(image[time,:,:]) # im2 = ax2.imshow(image2[time,:,:]) im2 = ax2.plot(image[0:time,5,5]) # def setvisible(self,vis): # for c in self.collections: c.set_visible(vis) # im2.set_visible = types.MethodType(setvisible,im2,None) # im2.axes = plt.gca() ims.append([im, im2]) #run animation ani = anim.ArtistAnimation(fig,ims, interval=50,blit=False) plt.show()
I was also curious if anyone knew of a cool way to extract a pixel from which 1D data is extracted, or even draw a line from the pixel to the right-most subtask so that they are โconnectedโ in some way.
Adrian