Robin Andrews
Robin Andrews

Reputation: 3804

Python Dash Core Components Graph() with Plotly Express

What is the relationship between Dash Core Components Graph() and Plotly Express?

For example, I can create a graph with

dcc.Graph(
            figure={
                "data": [
                    {
                        "x": data["DateTime"],
                        "y": data["Gold"],
                        "type": "lines",
                    },
                ],
                "layout": {
                    "title": "Gold Price"
                },
            },
        )

but many of the tutorials I've seen use plotly express in conjunction with dcc.Graph(), so it doesn't appear to be an either/or situation.

Is it a bad idea to just use dcc.Graph()? What would the advantage be of using plotly express as well?

Upvotes: 0

Views: 716

Answers (1)

Adam Boyher
Adam Boyher

Reputation: 36

The benefit of using plotly express is that it’s easier to make a figure. I use dash a lot and I’ve never made a dcc.Graph() building it like you described. I’ve always used express or graph_objects. Either way, when you make a the dcc graph object is the same after it’s made.

Upvotes: 1

Related Questions