Hi;
I’m trying to use a Jumbotron
container to display multiple graphs, including examples of the machine learning graphs found here: Knn classification in Python
These examples all use the plotly.graph_objects
library.
I’ve created the graphs and know they work, but when I try to include them into the dashboard, the output displays empty graphs.
Here is my code for the jumbotron object:
# Jumbotron that will display an empty figure on first launch, on when a user changes a dataset or ml model
classificationModelOutput_jumbotron = dbc.Col(
html.Div(
[
html.H2("Classification Model Output"),
dcc.Markdown(
"""
Bellow are 2 different visualizations of how the model understood the dataset. These graphs are called the following:
1. Contour Map
2. Decision Boundary
How did your model do?
""",
),
html.Hr(className="my-2"),
dbc.Row(
[
dbc.Col(
[
scatterPlotModelCard
]
),
dbc.Col(
[
confusionMatrixCard
]
)
]
),
dbc.Row(
[
dbc.Col(
[
contourMapCard
]
),
dbc.Col(
[
decisionBoundaryCard
]
)
]
),
],
className = "h-100 p-5 bg-white border rounded-3",
id = "classificationModelOutput_jumbotron"
)
)
Here is the code defining the graphs:
# Cards that will display Classification outputs
scatterPlotModelCard = dbc.Card(
dcc.Graph(id = 'scatterPlot_model', config = config)
)
confusionMatrixCard = dbc.Card(
dcc.Graph(id = 'confusionMatrix', config = config)
)
contourMapCard = dbc.Card(
dcc.Graph(id = 'contourMap', config = config)
)
decisionBoundaryCard = dbc.Card(
dcc.Graph(id = 'decisionBoundary', config = config)
)
And here is the output:
I’m using a similar pattern as above to show other graphs, but these graphs are using the plotly.express
library.
Does anyone know if plotly.graph_objects
can be used with bootstrap components? Or if there is something special that I need to do in order to use graph objects with dbc?
Thanks!