pencil.visu.animate_interactive

Versatile interactive plotting routine for slices and tomography.

Functions

animate_interactive(data[, t, dim_order, fps, title, ...])

Assemble a 2D animation from a 3D array.

Module Contents

pencil.visu.animate_interactive.animate_interactive(data, t=None, dim_order=(0, 1, 2), fps=10.0, title=None, x_label='x', y_label='y', font_size=24, color_bar=0, colorbar_label=None, sloppy=True, fancy=False, range_min=None, range_max=None, extent=[-1, 1, -1, 1], shade=False, azdeg=0, altdeg=65, arrows_x=None, arrows_y=None, arrows_res_x=10, arrows_res_y=10, arrows_pivot='mid', arrows_width=0.002, arrows_scale=5, arrows_color='black', plot_arrows_grid=False, movie_file=None, bitrate=1800, keep_images=False, figsize=(8, 7), dpi=300, **kwimshow)

Assemble a 2D animation from a 3D array.

call signature:

animate_interactive(data, t=None, dim_order=(0, 1, 2),

fps=10.0, title=None, x_label=’x’, y_label=’y’, font_size=24, color_bar=0, colorbar_label=None, sloppy=True, fancy=False, range_min=None, range_max=None, extent=[-1, 1, -1, 1], shade=False, azdeg=0, altdeg=65, arrows_x=None, arrows_y=None, arrows_res_x=10, arrows_res_y=10, arrows_pivot=’mid’, arrows_width=0.002, arrows_scale=5, arrows_color=’black’, plot_arrows_grid=False, movie_file=None, bitrate=1800, keep_images=False, figsize=(8, 7), dpi=300, **kwimshow)

Assemble a 2D animation from a 3D array. data has to be a 3D array of shape [nt, nx, ny] and who’s time index has the same dimension as t. The time index of data as well as its x and y indices can be changed via dim_order.

Keyword arguments:

dim_order:

Ordering of the dimensions in the data array (t, x, y).

fps:

Frames per second of the animation.

title:

Title of the plot.

x_label:

Label of the x-axis.

y_label:

Label of the y-axis.

font_size:

Font size of the title, x and y label. The size of the x- and y-ticks is 0.5*font_size and the colorbar ticks’ font size is 0.5*font_size.

color_bar: [ 0 | 1 ]

Determines how the colorbar changes: (0 - no cahnge; 1 - adapt extreme values).

colorbar_label:

Label of the color bar.

sloppy: [ True | False ]

If True the update of the plot lags one frame behind. This speeds up the plotting.

fancy: [ True | False ]

Use fancy font style.

range_min, range_max:

Range of the colortable.

extent: [ None | (left, right, bottom, top) ]

Limits for the axes (domain).

shade: [ False | True ]

If True plot a shaded relief instead of the usual colormap. Note that with this option cmap has to be specified like cmap = plt.cm.hot instead of cmap = ‘hot’. Shading cannot be used with the color_bar = 0 option.

azdeg, altdeg:

Azimuth and altitude of the light source for the shading.

arrows_x:

Data containing the x-component of the arrows.

arrows_y:

Data containing the y-component of the arrows.

arrows_res_xY:

Plot every arrows_res_xY arrow in x and y.

arrows_pivot: [ ‘tail’ | ‘middle’ | ‘tip’ ]

The part of the arrow that is used as pivot point.

arrows_width:

Width of the arrows.

arrows_scale:

Scaling of the arrows.

arrows_color:

Color of the arrows.

plot_arrows_grid: [ False | True ]

If ‘True’ the grid where the arrows are aligned to is shown.

movie_file: [ None | string ]

The movie file where the animation should be saved to. If ‘None’ no movie file is written. Requires ‘ffmpeg’ to be installed.

bitrate:

Bitrate of the movie file. Set to higher value for higher quality.

keep_images: [ False | True ]

If ‘True’ the images for the movie creation are not deleted.

figsize:

Size of the figure in inches.

dpi:

Dots per inch of the frame.

**kwimshow:

Remaining arguments are identical to those of pylab.imshow. Refer to that help.