Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

API reference

Plotly API reference

Plotly interactive charts

Identifiers
108
With full guides
88
Types
3

Topics covered

  • Plotly Express
  • Graph Objects
  • Figures & traces
  • Layout
  • Subplots
  • Interactivity
  • Dashboards
  • Exporting

Class

NameWhat it does
FigureClass
go.Scattergo.Scatter is Plotly’s generic graph_objects trace for two-dimensional scatter visualizations. Its mode controls whether data appears as markers, lines, or both.
go.Bargo.Bar creates an interactive bar-chart trace for Plotly graph-object figures. Configure coordinates with x and y, then add labels, hover text, orientation, and multi-trace layout behavior as needed.
go.Figurego.Figure constructs a Plotly graph-object figure from optional traces and layout settings. Start empty for incremental construction or provide data and layout immediately.
go.Histogramgo.Histogram creates an interactive histogram trace from raw observations. Use x for vertical histograms and y for horizontal histograms.
go.Boxgo.Box is Plotly's graph-objects class for building interactive box-plot traces. Add one or more Box traces to a Figure, typically by supplying observations through x or y.
go.Violingo.Violin creates a configurable interactive violin trace from plotly.graph_objects. Use it when the lower-level Graph Objects API is preferable to Plotly Express.
go.Piego.Pie defines a Plotly pie trace from sector labels and values. Add it to a go.Figure to render an interactive pie chart.
go.Heatmapgo.Heatmap creates an interactive Cartesian heatmap from two-dimensional values, rendering them as colored rectangular tiles. Add it to a go.Figure and customize coordinates, colors, smoothing, and the color bar.
go.Contourgo.Contour creates an interactive 2D contour plot from a numerical z array. Optional one-dimensional x and y arrays specify the horizontal and vertical coordinates.
go.Surfacego.Surface creates an interactive 3D surface trace from gridded z values, with optional x/y coordinates and configurable coloring. Add it to a go.Figure to display the surface.
go.Scatter3dgo.Scatter3d creates an interactive 3D scatter trace from x, y, and z coordinates. Use it when direct graph-object control is preferable to Plotly Express.
go.Mesh3dgo.Mesh3d draws a 3D triangular mesh from vertex coordinates. Plotly can triangulate the coordinates automatically, or accept explicit triangle indices through i, j, and k.
go.CandlestickA Plotly graph-object trace for displaying financial open, high, low, and close values at each x coordinate. It is commonly used with time-based x values and supports configurable candle appearance and interaction.
go.Ohlcgo.Ohlc creates an interactive financial trace for open, high, low, and close values at each x coordinate. It is commonly used with time-series data to visualize price movement.
go.Choroplethgo.Choropleth creates an outline-based choropleth trace, coloring geographic polygons from numeric z values. Use locations with a matching locationmode, and configure the surrounding geographic subplot through layout.geo.
go.Scattergeogo.Scattergeo is Plotly’s geographic scatter/line trace for plotting markers and paths from longitude and latitude coordinates. Its map background is controlled through the figure’s layout.geo configuration.
go.ScattermapboxClass
go.Sankeygo.Sankey creates an interactive flow diagram in Plotly. Nodes are named with labels, while indexed links connect sources to targets and use values to control flow width.
go.Treemapgo.Treemap is a Plotly trace for representing hierarchical data with nested rectangles. Its sectors are defined by labels or IDs, parent relationships, and optionally numeric values.
go.Sunburstgo.Sunburst creates an interactive hierarchical sunburst trace. Define sectors with labels and connect them through parents, using an empty parent for the root.
go.Indicatorgo.Indicator visualizes one value as a number, delta, gauge, or combination. Its mode selects the rendered components, while related settings control comparison, formatting, and placement.
go.Tablego.Table creates an interactive Plotly table trace for displaying detailed data in a row-and-column grid. Its body data is supplied in column-major order, with styling available for headers, columns, rows, and cells.
go.WaterfallA Plotly graph-object trace for visualizing how positive and negative contributions build to totals in a waterfall chart. Vertical charts use y for values and x for labels by default.
go.Funnelgo.Funnel is a Plotly graph-object trace for displaying process stages as length-encoded bars. It supports both part-to-whole and drop-off funnel representations.
go.Scatterpolargo.Scatterpolar is Plotly's generic polar scatter trace. Pair radial coordinates (r) with angular coordinates (theta) and optionally render markers, lines, or a filled region.
go.Imagego.Image displays multichannel image data as a Plotly graph-object trace. Provide raw pixel values with z or a base64-encoded image through source.
DashDash is the main application class for creating Python analytical web apps. Instantiate it, define a component layout, optionally register callbacks, and run the app to serve interactive Plotly-based interfaces.
dcc.GraphClass
html.Divhtml.Div is Dash's component wrapper for the HTML5 <div> element. Use it to group text or nested components in an app layout, with properties such as children, id, className, and style.
go.Scatterglgo.Scattergl creates WebGL-rendered scatter traces for interactive point or line charts. It is useful for larger datasets where faster rendering and interaction matter.
go.Histogram2dgo.Histogram2d is a Plotly graph-object trace for visualizing paired x/y data as a two-dimensional binned heatmap. Bins can show point counts or aggregate supplied z values.
go.Histogram2dContourgo.Histogram2dContour creates a graph-object trace that displays paired x/y observations as a two-dimensional density contour plot. Add it to a Figure and customize its color scale and trace properties.
go.Parcoordsgo.Parcoords creates an interactive parallel-coordinates trace for multidimensional exploratory analysis. Define variables in dimensions and control sample-path coloring through line.
go.ParcatsClass
go.DensitymapboxClass
go.ChoroplethmapboxClass
go.VolumeA Volume trace renders a scalar field as partially transparent 3-D isosurfaces. Supply x, y, z coordinates and a value for every vertex, then control bounds, opacity, slices, caps, and spaceframe rendering.
go.Isosurfacego.Isosurface creates a 3D Plotly trace for scalar-field isosurfaces. Provide x, y, z, and value arrays, then control the displayed range with isomin and isomax.
go.Conego.Cone creates a 3D cone trace for visualizing vector fields. Provide position arrays x, y, z and vector components u, v, w.
go.Streamtubego.Streamtube creates a 3D flow visualization from six equal-length one-dimensional arrays: positions x, y, z and vector components u, v, w. Optional starts coordinates choose tube origins.
go.CarpetA go.Carpet trace defines a Plotly carpet plot using parameter coordinates a and b and plotted coordinates x and y. Its aaxis and baxis settings control the carpet axes, while related traces can reference it by identifier.
go.Splomgo.Splom creates an interactive scatterplot matrix from multiple variables. Provide each variable once through dimensions, rather than defining separate x/y data for every pair.
go.PointcloudClass

Function

NameWhat it does
px.scatterpx.scatter creates an interactive two-dimensional scatter plot, placing each observation as a marker at its x and y values. Data can come from dataframe columns or array-like sequences, with optional visual encodings such as color, size, and trendlines.
px.linepx.line creates an interactive 2D line chart by connecting data points into polyline marks. It accepts direct sequences or data-frame columns and supports encodings such as color and visible markers.
px.barFunction
update_layoutUpdates a Plotly figure's layout from a dictionary, keyword arguments, or both. Updates are recursive by default and the Figure object is returned.
add_traceAdds a graph-object trace or trace dictionary to a Plotly figure. Subplot coordinates and secondary-axis options can control where the trace is placed.
px.histogramFunction
make_subplotsCreates a Plotly Figure with a configurable grid of subplots. It supports shared axes, titles, spacing, relative dimensions, specialized subplot types, and per-cell configuration.
px.piepx.pie creates an interactive pie chart from tabular data. It maps numeric values to sector sizes and categories to labels, with options for hover content, naming, and further figure customization.
px.boxCreates interactive box-and-whisker plots from tabular or array-like data. It supports grouping, facets, colors, point overlays, notches, logarithmic axes, and other figure styling options.
px.violinCreates an interactive violin plot for visualizing numerical-data distributions. It supports categorical comparisons, box plots, and optional observation points.
px.areaFunction
px.scatter_3dCreates an interactive three-dimensional scatter plot, with each data-frame row represented as a point. Map columns or arrays to x, y, and z, then optionally encode additional variables through color, size, symbol, and other Plotly Express options.
px.line_3dpx.line_3d creates an interactive 3D line chart by connecting points defined by x, y, and z data. Use grouping options such as color to render multiple trajectories.
px.scatter_matrixpx.scatter_matrix builds an interactive scatterplot matrix for multiple numerical variables. Choose included columns with dimensions and distinguish observations with color.
px.density_heatmappx.density_heatmap creates an interactive 2D histogram, grouping x/y observations into bins and coloring each tile by count or an aggregation of z. Bin resolution and color mapping are configurable.
px.density_contourpx.density_contour creates an interactive 2D density-contour plot by binning x/y observations and aggregating each bin. It supports counts by default, or aggregation of a supplied z variable with histfunc.
px.imshowCreates a Plotly figure from matrix-like data, rendering scalar values as heatmap pixels or displaying RGB/RGBA image arrays. The result is a customizable interactive figure.
px.choroplethCreates an interactive outline choropleth map, coloring geographic polygons according to supplied values. It supports built-in country and US-state geometries as well as custom GeoJSON boundaries.
px.scatter_geopx.scatter_geo creates an outline-map scatter plot where each data-frame row becomes a geographic marker. Columns can control marker location, color, size, and hover content.
px.scatter_mapboxFunction
px.treemappx.treemap creates interactive treemap charts for hierarchical data. Supply explicit names and parents, or use path to derive levels from dataframe columns.
px.sunburstpx.sunburst creates interactive sunburst charts for hierarchical data. Define the hierarchy with path columns or explicit ids and parents, and optionally control sector size and color.
px.icicleCreates an interactive icicle chart for hierarchical data, using rectangular sectors arranged from root to leaves. The hierarchy can be supplied explicitly with names and parents or inferred from a path of columns.
px.funnelFunction
px.timelinepx.timeline creates a Plotly timeline in which each data-frame row becomes a horizontal bar spanning start and end dates. It returns a figure with a date x-axis by default and supports categorical or continuous color mapping.
px.parallel_coordinatespx.parallel_coordinates creates an interactive parallel-coordinates plot from tabular data. Rows become polylines, while selected dimensions become parallel axes and an optional continuous field controls line color.
px.parallel_categoriesCreates an interactive parallel categories diagram for multidimensional categorical data. Dimensions become category columns, while ribbons show category combinations and their relative frequencies.
px.strippx.strip creates an interactive strip chart that displays individual observations across categories or numeric values. It is useful when the points themselves matter more than a summarized box or violin shape.
px.ecdfpx.ecdf creates an empirical cumulative distribution function plot from tabular or array-like data. It supports category-based comparisons, multiple distributions, normalization choices, markers, and standard or reversed cumulative modes.
px.scatter_polarCreates an interactive polar scatter plot, mapping observations to radial and angular coordinates. Marker appearance can encode additional variables such as color, symbol, and size.
px.line_polarpx.line_polar creates an interactive polar line chart by mapping values to radial (r) and angular (theta) coordinates. It supports grouping, closed paths, and radar-style visualizations.
px.bar_polarpx.bar_polar creates an interactive polar bar chart, mapping values radially and categories or angles around the circle. It supports grouping and styling through Plotly Express arguments such as color, templates, and color sequences.
pio.showDisplays a Plotly figure using the renderer framework. You can use the configured default renderer or select an available renderer for a particular display call.
pio.write_htmlFunction
pio.templatesplotly.io.templates stores registered Plotly themes and exposes the global default. Inspect it, select a named template for a figure, register custom templates, or change the default used by new figures.
callbackRegisters a callback for clicks on one or more points in a Plotly trace. It is intended for traces displayed through FigureWidget in an ipywidget context.
InputFunction
OutputFunction
StateFunction
px.density_mapboxFunction
px.choropleth_mapboxFunction
px.scatter_ternaryCreates an interactive ternary scatter plot with Plotly Express, representing each data-frame row as a point. The a, b, and c arguments define the three ternary components, while optional encodings can control color, size, and hover content.
px.line_ternaryCreates an interactive ternary line plot from tabular data. Rows become ternary points, while coordinate, grouping, color, and other Plotly Express arguments control the generated figure.
px.funnel_areaFunction

Module

NameWhat it does
graph_objectsplotly.graph_objects is Plotly’s low-level Python interface for constructing figures from traces, layouts, and related graph-object classes. Its Figure objects support validation, manipulation, rendering, and serialization.
fig.update_layoutUpdates a Plotly figure's layout-level properties, including titles, dimensions, margins, axes, legends, and interaction settings. Properties can be passed as nested dictionaries or compound keyword arguments.
fig.update_tracesUpdates properties on one or more Plotly figure traces. Selectors and subplot coordinates let you limit which traces are changed.
fig.update_xaxesUpdates layout properties on one or more x-axes in a Plotly graph-object figure. It can apply broadly or target a subplot with row and col selectors, and returns the modified figure.
fig.update_yaxesUpdates one or more y-axes on a Plotly graph-object Figure. Use keyword arguments to set layout.yaxis properties such as titles, ranges, grid visibility, and tick formatting.
fig.add_traceAdds one trace to a Plotly graph-object figure and returns the modified figure. It also supports selecting a subplot and, where configured, its secondary y-axis.
fig.add_shapeAdds a standalone geometric shape—such as a line, ellipse, rectangle, or path—to a Plotly figure. Its coordinates can be tied to subplot axes or positioned relative to the figure.
fig.add_annotationAdds a standalone text annotation to a Plotly figure, optionally with an arrow. Coordinates can refer to subplot axes, the figure’s paper space, or an axis domain.
fig.add_hlineAdds a horizontal layout line at a specified y-coordinate, spanning infinitely in the x-dimension. It supports subplot targeting, optional annotation, and line styling.
fig.add_vlineAdds a vertical reference line at an x coordinate to a Plotly figure or subplot. It can be targeted to subplot cells, annotated, and styled through shape-related options.
fig.showDisplays a Plotly Figure or figure dictionary through the default renderer or one or more selected registered renderers. Validation is enabled by default, and display options such as dimensions and configuration can be passed as keyword arguments.
fig.write_htmlWrites a Plotly figure as an interactive HTML file that can be opened in a browser. The default output is self-contained; export options control dependency inclusion and document structure.
fig.write_imageExports a Plotly figure as a static PNG, JPEG, WebP, SVG, or PDF file. The output format can be inferred from the destination or supplied explicitly.
fig.to_jsonFigure.to_json() converts a Plotly figure to a JSON string. It supports validation, readable formatting, UID removal, and selectable JSON encoding engines.
fig.add_scatterAdds a scatter trace to a Plotly figure, with support for x/y data, rendering modes, labels, styling, and subplot placement. It returns the updated figure for continued construction or display.
fig.for_each_traceApplies a callback to each figure trace that matches optional selection criteria. The callback can inspect and update traces individually, making conditional trace changes straightforward.
fig.update_geosfig.update_geos() updates geographic layout properties on a Plotly figure. Use it to control map appearance, positioning, projection, boundaries, and geographic extents.
fig.update_coloraxesfig.update_coloraxes updates shared continuous-color settings on a Plotly figure, including the colorscale, color domain, and colorbar. It accepts color-axis properties as keyword arguments.
fig.add_barfig.add_bar() creates and appends a Plotly Bar trace to a figure. It supports incremental figure construction and can place the trace in a chosen subplot.
fig.add_heatmapModule

Search across every package and filter by type in your dashboard.

Start learning