Create real-time plots in Jupyter Notebooks.

class ProgressPlot[source]

ProgressPlot(plot_names=['plot'], line_names=['line-1'], line_colors=None, x_lim=[None, None], y_lim=[None, None], x_label='iteration', x_iterator=True, height=None, width=600, display_fn='display', debug=False) :: PlotLearningCurve

Real-time progress plots for Jupyter notebooks.

Parameters

plot_names : list of str, optional, default: ['plot'] Labels for plots. Length also determines number of plots.

line_names: list of str, optional, default: ['line-1'] Labels for lines. Length also determines number of lines per plot.

line_colors: list of str, optional, default: None Color cycle for lines in hex format. If None the standard matplotlib color cycle is used.

x_lim: list, optional, default: [None, None] List with [x_min, x_max]. If value is None the axes on that side is dynamically adjusted.

y_lim: list, optional, default: [None, None] List with [y_min, y_max]. If value is None the axes on that side is dynamically adjusted.

x_label='iteration': str, optional, default: 'iteration' Label for the x-axis. Default is 'iteration'

x_iterator: boolean, optional, default: True If flag is True an internal iterator is used as x values for the plot. If False the update function requires an x value.

height: int, optional, default: None The height in pixels of the plot (default None). The default behavior is to use 200px per facet and an additional 90px for the x-axis and legend.

width: int, optional, default: 600 The width in pixels of the plot (default 600).

display_fn: callable, optional, default: IPython.display.display To display HTML or JavaScript in a notebook with an IPython backend, IPython.display.display is called. The called function can be overwritten by setting this argument (mostly useful for internal testing).

debug: boolean, optional, default: False Depending on the notebook, a JavaScript evaluation does not provide a stack trace in the developer console. Setting this to true works around that by injecting <script> tags instead.

Example

from jupyterplot import ProgressPlot

pp = ProgressPlot()
for i in range(100):
    pp.update(1 / (i + 1))
pp.finalize()
import numpy as np

pp = ProgressPlot(x_iterator=False, x_lim=[-1, 1], y_lim=[-1, 1])
for i in range(1001):
    pp.update(np.sin(2 * np.pi * i / 1000), np.cos(2 * np.pi * i / 1000))
pp.finalize()