NOTE: For technical reasons, all interactive-widgets plots in this documentation are created using Holoviz’s Panel. Often, they will ran just fine with ipywidgets too. However, if a specific example uses the param library, then users will have to modify the params dictionary in order to make it work with ipywidgets. Refer to Interactive module for more information.*args, aspect=None, axis_center=None, is_polar=None, legend=None, show=True, size=None, title=None, xlabel=None, ylabel=None, zlabel=None, xlim=None, ylim=None, zlim=None, **kwargs)[source]

Plots a collection of data series.


Instances of BaseSeries or lists of instances of BaseSeries.

aspect(float, float) or str, optional

Set the aspect ratio of the plot. The value depends on the backend being used. Read that backend’s documentation to find out the possible values.

axis_center(float, float), optional

Tuple of two floats denoting the coordinates of the center or {‘center’, ‘auto’}. Only available with MatplotlibBackend.

backendPlot, optional

A subclass of Plot, which will perform the rendering. Default to MatplotlibBackend.

is_polarboolean, optional

Default to False. If True, requests the backend to use a 2D polar chart, if implemented.

legendbool, optional

Show/hide the legend. Default to None (the backend determines when it is appropriate to show it).

showbool, optional

The default value is set to True. Set show to False and the function will not display the plot. The returned instance of the Plot class can then be used to save or display the plot by calling the save() and show() methods respectively.

size(float, float), optional

A tuple in the form (width, height) to specify the size of the overall figure. The default value is set to None, meaning the size will be set by the backend.

titlestr, optional

Title of the plot.

use_latexboolean, optional

Turn on/off the rendering of latex labels. If the backend doesn’t support latex, it will render the string representations instead.

xlabel, ylabel, zlabelstr, optional

Labels for the x-axis, y-axis or z-axis, respectively.

xscale, yscale, zscale‘linear’ or ‘log’, optional

Sets the scaling of the x-axis, y-axis, z-axis, respectively. Default to 'linear'. Some backend might not implement this feature.

xlim, ylim, zlim(float, float), optional

Denotes the x-axis/y-axis/z-axis limits, respectively, (min, max).


Refer to the documentation of a backend class in order to find more available keyword arguments.

pPlot or InteractivePlot

If any of the data series is interactive (params has been set) then an instance of InteractivePlot is returned, otherwise an instance of the Plot class is returned.

See also



Combining together multiple data series of the same type:

>>> from sympy import *
>>> from spb import *
>>> x = symbols("x")
>>> graphics(
...     line(cos(x), label="a"),
...     line(sin(x), (x, -pi, pi), label="b"),
...     line(log(x), rendering_kw={"linestyle": "--"}),
...     title="My title", ylabel="y"
... )
Plot object containing:
[0]: cartesian line: cos(x) for x over (-10.0, 10.0)
[1]: cartesian line: sin(x) for x over (-3.141592653589793, 3.141592653589793)
[2]: cartesian line: log(x) for x over (-10.0, 10.0)

(Source code, png, hires.png, pdf)


Interactive-widget plot combining together data series of different types:

from sympy import *
from spb import *
import k3d
a, b, s, e, t = symbols("a, b, s, e, t")
c = 2 * sqrt(a * b)
r = a + b
params = {
    a: (1.5, 0, 2),
    b: (1, 0, 2),
    s: (0, 0, 2),
    e: (2, 0, 2)
        (r * cos(t), r * sin(t)), (t, 0, pi),
        params=params, n=50, parallel_axis="x", show_curve=False,
        a * cos(t) + b * cos(3 * t),
        a * sin(t) - b * sin(3 * t),
        c * sin(2 * t), prange(t, s*pi, e*pi),
        rendering_kw={"color_map": k3d.matplotlib_color_maps.Summer},
    backend=KB, use_latex=False

(Source code, small.png)