When drawing graphs in Plotly, if you read the documentation or read about it in various articles, you may wonder what the difference is between the two ways of importing and using it. Is there a difference?
Concretely, it looks like this.
# If you are importing matplotlib import matplotlib.pyplot as plt # For plotly, there are two types import plotly.express as px import plotly.graph_objects as go
So, in this article, we will summarize one of plotly's graph drawing methods, "graph_objects"!
The difference between Express and graph_objects
The first question that comes to mind is, "What's the difference? I'll tell you the conclusion first. "The contents are the same".
What this means is that when you use a function in Plotly Express, it internally calls graph_objects and returns a value. In other words, some of the Express functions are useful in that they implement things that would take 5-100 lines to draw using graph_objects!
Why am I writing an article about graph_object?
In this blog, I basically adopt graph_objects when explaining plotly. The reason for this is that I feel that understanding graph_objects, which is a more fundamental idea, will help you understand Express when you try to use it.
(As of July 1, 2021, most of the articles I've written focus on basic operations, so if you want to use plotly more easily or write less code, please contact me. If you want to use plotly more easily or with less code, I'd be happy to write about Express as well).