Python matplotlib.animation.ArtistAnimation() Examples

The following are code examples for showing how to use matplotlib.animation.ArtistAnimation(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the ones you don't like. You can also save this page to your account.

Example 1
Project: CoherentXrayImaging   Author: susannahammarberg   File:    (license) View Source Project 6 votes vote down vote up
def plot_summed_patterns_one_point(row,col):
    # sum the diffrtaction patterns in one point
    summed_point = 0
    for j in range(0,nbr_rotations):
        summed_point  = summed_point + list_Merlin[j][row][col].toarray()  
    plt.imshow(np.log10(summed_point), cmap = 'hot', interpolation = 'none')
    plt.title('masked diffraction patterns sum of one position in %d scans'%nbr_rotations)
#plot_summed_patterns_one_point(8,49)   #inser col and row you want to plot

#            # anim TABORT
#            im = plt.imshow(abs(objectFunc), animated=True, interpolation='none', extent=[0,6.837770297837617,0,6.825238081022181])
#                    ims.append([im])
#                    ani = animation.ArtistAnimation(fig, ims, interval=1500, blit=True,repeat_delay=2000)
# plot diffraction patterns merlin + pilK100 
Example 2
Project: BRATS   Author: ahmedhussein622   File:    (license) View Source Project 5 votes vote down vote up
def draw_MRI(image_3d_gray, interval = 50, repeat_delay=500):
    draws a 3d image in time laps
    image_3d_gray : 3d numpy array of gray scale
    fig = plt.figure()
    ims = []
    for i in range(image_3d_gray.shape[0]):
        im = plt.imshow(image_3d_gray[i], cmap = "Greys_r")
    ani = animation.ArtistAnimation(fig, ims, interval=interval, blit=False, repeat_delay=repeat_delay) 
Example 3
Project: evolearn   Author: chadwcarlson   File:    (license) View Source Project 5 votes vote down vote up
def animate(self):

        """animate function for actually generating figure from Animation instance.

        ani = animation.ArtistAnimation(self.fig, self.frames, interval=self.interval, blit=self.blit, repeat_delay=self.repeat_delay)
Example 4
Project: gm-cml   Author: wangyida   File:    (license) View Source Project 4 votes vote down vote up
def build_gif(imgs, interval=0.1, dpi=72,
              save_gif=True, saveto='animation.gif',
              show_gif=False, cmap=None):
    """Take an array or list of images and create a GIF.

    imgs : np.ndarray or list
        List of images to create a GIF of
    interval : float, optional
        Spacing in seconds between successive images.
    dpi : int, optional
        Dots per inch.
    save_gif : bool, optional
        Whether or not to save the GIF.
    saveto : str, optional
        Filename of GIF to save.
    show_gif : bool, optional
        Whether or not to render the GIF using plt.
    cmap : None, optional
        Optional colormap to apply to the images.

    ani : matplotlib.animation.ArtistAnimation
        The artist animation from matplotlib.  Likely not useful.
    imgs = np.asarray(imgs)
    h, w, *c = imgs[0].shape
    fig, ax = plt.subplots(figsize=(np.round(w / dpi), np.round(h / dpi)))

    if cmap is not None:
        axs = list(map(lambda x: [
            ax.imshow(x, cmap=cmap)], imgs))
        axs = list(map(lambda x: [
            ax.imshow(x)], imgs))

    ani = animation.ArtistAnimation(
        fig, axs, interval=interval, repeat_delay=0, blit=False)

    if save_gif:, writer='imagemagick', dpi=dpi)

    if show_gif:

    return ani