animplot

hhpy.plotting.animplot(data: pandas.core.frame.DataFrame = None, x: str = 'x', y: str = 'y', t: str = 't', lines: Mapping[KT, VT_co] = None, max_interval: int = None, time_per_frame: int = 200, mode: str = None, title: bool = True, title_prefix: str = '', t_format: str = None, fig: matplotlib.figure.Figure = None, ax: matplotlib.axes._axes.Axes = None, color: str = None, label: str = None, legend: bool = False, legend_out: bool = False, legend_kws: Mapping[KT, VT_co] = None, xlim: tuple = None, ylim: tuple = None, ax_facecolor: Union[str, Mapping[KT, VT_co]] = None, grid: bool = False, vline: Union[Sequence[T_co], float] = None, **kwargs) → Union[IPython.core.display.HTML, matplotlib.animation.FuncAnimation][source]

wrapper for FuncAnimation to be used with pandas DataFrames. Assumes that you have a DataFrame containing one data point for each x-y-t combination.

If mode is set to jshtml the function is optimized for use with Jupyter Notebook and returns an Interactive JavaScript Widget.

Parameters:
  • data – Pandas DataFrame containing named data, optional if vector data is used
  • x – Name of the x variable in data
  • y – Name of the y variable in data
  • t – Name of the t variable in data
  • lines – you can also pass lines that you want to animate. Details to follow [optional]
  • max_interval – max interval at which to abort the animation [optional]
  • time_per_frame – time per frame [optional]
  • mode

    one of the below [optional]

    • matplotlib: Return the matplotlib FuncAnimation object
    • html: Returns an HTML5 movie (You need to install ffmpeg for this to work)
    • jshtml: Returns an interactive Javascript Widget
  • title – whether to set the time as plot title [optional]
  • title_prefix – title prefix to be put in front of the time if title is true [optional]
  • t_format – format string used to format the time variable in the title [optional]
  • fig – figure to plot on [optional]
  • ax – axes to plot on [optional]
  • color – Color used for plotting, must be known to matplotlib.pyplot [optional]
  • label – Label to use for the data [optional]
  • legend – Whether to show a legend [optional]
  • legend_out – Whether to draw the legend outside of the axis, can also be a location string [optional]
  • legend_kws – Other keyword arguments passed to pyplot.legend [optional]
  • xlim – X limits for the axis as tuple, passed to ax.set_xlim() [optional]
  • ylim – Y limits for the axis as tuple, passed to ax.set_ylim() [optional]
  • ax_facecolor – passed to ax.set_facecolor, can also be a conditional mapping to change the facecolor at specific timepoints t [optional]
  • grid – Whether to toggle ax.grid() [optional]
  • vline – A list of x positions to draw vlines at [optional]
  • kwargs – other keyword arguments passed to pyplot.plot
Returns:

see mode

Examples

Check out the example notebook