LineChart

class pandas_alive.charts.LineChart(df: pandas.core.frame.DataFrame, interpolate_period: bool, steps_per_period: int, period_length: int, period_fmt: str, figsize: Tuple[float, float], title: str, fig: matplotlib.figure.Figure, cmap: Union[str, matplotlib.colors.Colormap, List[str]], tick_label_size: Union[int, float, str], period_label: Union[bool, Dict[str, Union[int, float, str]]], period_summary_func: Callable, fixed_max: bool, dpi: int, writer: str, enable_progress_bar: bool, kwargs, line_width: int, label_events: Dict[str, str], fill_under_line_color: str, add_legend: bool)[source]

Animated Line Chart implementation

Parameters

BaseChart (BaseChart) – Shared Base Chart class inherit to all charts

Returns

Animated Line Chart class for use with multiple plots or save

Return type

LineChart

Methods

LineChart.__init__(df, interpolate_period, …)

Initialize self.

LineChart.anim_func(i)

Animation function, updates all lines and legend/period annotation.

LineChart.apply_style(ax)

Apply styling to axes with spines and grid, can be overridden

LineChart.calculate_new_figsize(real_fig)

Calculate figure size to allow for labels, etc

LineChart.clearing()

Function to remove all existing lines, collections, etc at the start of the animation AND after a save.

LineChart.create_figure()

Create base figure with styling, can be overridden if styling unwanted

LineChart.get_colors(cmap)

Get colours for plotting data

LineChart.get_data_cols(df)

Get list of columns containing plottable numeric data to plot

LineChart.get_frames()

Method for determining range of frames to animate.

LineChart.get_html5_video()

Convert the animation to an HTML5 <video> tag.

LineChart.get_interpolated_df(df, …)

Get interpolated dataframe to span total animation

LineChart.get_period_label(period_label)

Parameters for period annotation on charts, dict will be passed to kwargs in matplotlib.ax.text()

LineChart.get_single_color(color_string)

Get single RBGA value from string

LineChart.init_func()

Initialization function for animation

LineChart.make_animation(frames, init_func)

Method for creating animation

LineChart.plot_line(i)

Function for plotting all lines in dataframe

LineChart.rename_data_columns(df)

Converts all column names to string

LineChart.save(filename)

Save method for FuncAnimation.

LineChart.set_x_y_limits(df, i, ax)

Set axis limits for both x and y of passed axes object

LineChart.setup_progress_bar()

Create an instance of alive-progress bar in manual mode

LineChart.show_period(i)

Show period label on plot

LineChart.update_progress_bar()

Update TQDM instance by 1

LineChart.validate_params()

Validate figure is a matplotlib Figure instance