plotly package

https://plot.ly/python/

Plotly’s Python API allows users to programmatically access Plotly’s server resources.

This package is organized as follows:

Subpackages:

  • plotly: all functionality that requires access to Plotly’s servers

  • graph_objects: objects for designing figures and visualizing data

  • matplotlylib: tools to convert matplotlib figures

Modules:

  • tools: some helpful tools that do not require access to Plotly’s servers

  • utils: functions that you probably won’t need, but that subpackages use

  • version: holds the current API version

  • exceptions: defines our custom exception classes

Subpackages

Submodules

plotly.animation module

class plotly.animation.DurationValidator(plotly_name='duration')

Bases: _plotly_utils.basevalidators.NumberValidator

class plotly.animation.EasingValidator(plotly_name='easing', parent_name='batch_animate', **_)

Bases: _plotly_utils.basevalidators.EnumeratedValidator

plotly.basedatatypes module

class plotly.basedatatypes.BaseFigure(data=None, layout_plotly=None, frames=None, skip_invalid=False, **kwargs)

Bases: object

Base class for all figure types (both widget and non-widget)

add_hline(y, row='all', col='all', exclude_empty_subplots=True, annotation=None, **kwargs)

Add a horizontal line to a plot or subplot that extends infinitely in the x-dimension.

Parameters
  • y (float or int) – A number representing the y coordinate of the horizontal line.

  • exclude_empty_subplots (Boolean) – If True (default) do not place the shape on subplots that have no data plotted on them.

  • row (None, int or 'all') – Subplot row for shape indexed starting at 1. If ‘all’, addresses all rows in the specified column(s). If both row and col are None, addresses the first subplot if subplots exist, or the only plot. By default is “all”.

  • col (None, int or 'all') – Subplot column for shape indexed starting at 1. If ‘all’, addresses all rows in the specified column(s). If both row and col are None, addresses the first subplot if subplots exist, or the only plot. By default is “all”.

  • annotation (dict or plotly.graph_objects.layout.Annotation. If dict(),) – it is interpreted as describing an annotation. The annotation is placed relative to the shape based on annotation_position (see below) unless its x or y value has been specified for the annotation passed here. xref and yref are always the same as for the added shape and cannot be overridden.

  • annotation_position (a string containing optionally ["top", "bottom"]) – and [“left”, “right”] specifying where the text should be anchored to on the line. Example positions are “bottom left”, “right top”, “right”, “bottom”. If an annotation is added but annotation_position is not specified, this defaults to “top right”.

  • annotation_* (any parameters to go.layout.Annotation can be passed as) – keywords by prefixing them with “annotation_”. For example, to specify the annotation text “example” you can pass annotation_text=”example” as a keyword argument.

  • **kwargs – Any named function parameters that can be passed to ‘add_shape’, except for x0, x1, y0, y1 or type.

add_hrect(y0, y1, row='all', col='all', exclude_empty_subplots=True, annotation=None, **kwargs)

Add a rectangle to a plot or subplot that extends infinitely in the x-dimension.

Parameters
  • y0 (float or int) – A number representing the y coordinate of one side of the rectangle.

  • y1 (float or int) – A number representing the y coordinate of the other side of the rectangle.

  • exclude_empty_subplots (Boolean) – If True (default) do not place the shape on subplots that have no data plotted on them.

  • row (None, int or 'all') – Subplot row for shape indexed starting at 1. If ‘all’, addresses all rows in the specified column(s). If both row and col are None, addresses the first subplot if subplots exist, or the only plot. By default is “all”.

  • col (None, int or 'all') – Subplot column for shape indexed starting at 1. If ‘all’, addresses all rows in the specified column(s). If both row and col are None, addresses the first subplot if subplots exist, or the only plot. By default is “all”.

  • annotation (dict or plotly.graph_objects.layout.Annotation. If dict(),) – it is interpreted as describing an annotation. The annotation is placed relative to the shape based on annotation_position (see below) unless its x or y value has been specified for the annotation passed here. xref and yref are always the same as for the added shape and cannot be overridden.

  • annotation_position (a string containing optionally ["inside", "outside"], ["top", "bottom"]) – and [“left”, “right”] specifying where the text should be anchored to on the rectangle. Example positions are “outside top left”, “inside bottom”, “right”, “inside left”, “inside” (“outside” is not supported). If an annotation is added but annotation_position is not specified this defaults to “inside top right”.

  • annotation_* (any parameters to go.layout.Annotation can be passed as) – keywords by prefixing them with “annotation_”. For example, to specify the annotation text “example” you can pass annotation_text=”example” as a keyword argument.

  • **kwargs – Any named function parameters that can be passed to ‘add_shape’, except for x0, x1, y0, y1 or type.

add_trace(trace, row