graph_objects
Anonymous contributor
Published Jun 18, 2024
Contribute to Docs
In Python, the graph_objects
module in Plotly is used for creating and manipulating complex plots and visualizations. It provides a structured way to build a wide variety of plot types using a declarative syntax. The core components of Plotly’s graph_objects
module are:
Figure
: Represent the entire visualization, including data, layout, and styling.Traces
: Define individual data sets and their properties (like markers, lines, etc.) within the figure.Layout
: Control the overall appearance and arrangement of the visualization, including axes, titles, annotations, and more.
Key Features
- Object-Oriented Approach: Allows for detailed customization and fine-grained control over plot attributes.
- Composability: Different plot types and layout elements can be composed together to create intricate and layered visualizations.
- Interactivity: Plots created with
graph_objects
are interactive, allowing for features such as zooming, panning, and tooltips. - Integration: Works seamlessly with various data sources and can be integrated into web applications using frameworks like Dash.
Applications
- Creating 3D trace types like mesh or isosurface.
- Generating subplots of different types and dual-axis plots.
- Faceting plots with multiple different types of traces.
Syntax
import plotly.graph_objects as go
The go
is an alias commonly used to refer to the graph_objects
module.
graph_objects
- .Barpolar()
- Creates a polar bar chart in Plotly.
- .Candlestick()
- Creates candlestick charts to visualize financial data, showing open, high, low, and close values over time.
- .Figure()
- Creates and manipulates figures in Plotly.
- .Heatmap()
- Creates a plot with data visualized as colored tiles.
- .Histogram2d()
- Generates a 2D histogram to show the distribution and relationship between two variables, with color intensity representing the frequency of data points.
- .Histogram2dContour()
- Creates 2D histograms with contours for visualizing density distributions in data.
- .Mesh3d()
- Creates a 3D mesh plot in Plotly using the graph_objects module.
- .Scatterpolar()
- Creates a scatter plot on polar axes.
- .Surface()
- Creates a 3d plot using the `Surface` class of the `graph_objects` module in Plotly
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Python:Plotly on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Skill path
Data Science Foundations
Learn to clean, analyze, and visualize data with Python and SQL.Includes 15 CoursesWith CertificateBeginner Friendly55 hours - Career path
Data Scientist: Machine Learning Specialist
Machine Learning Data Scientists solve problems at scale, make predictions, find patterns, and more! They use Python, SQL, and algorithms.Includes 27 CoursesWith Professional CertificationBeginner Friendly90 hours - Course
Learn Python 3
Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.With CertificateBeginner Friendly23 hours