I made a bar plot that shows up perfectly in jupyter notebook, but it doesnât work in browser (ran it with VSCode). Can anyone share some insights? The packages are updated.
Vis in JuputerNotebook
Vis in browser
Hey @skyblueface1 welcome to the forums.
Could you provide the source code and data to replicate the graph? Which Browser did you use and which plotly version? Your OS might be interesting to know too.
My Plotly version is 5.18, I tried visualizing with Chrome and Firefox, the results were the same. Windows 10 OS. Here is my source code >
Create a dash application
app = dash.Dash(name)
#Dash page layout
app.layout=html.Div(children=[html.H1(âDEIB Elements in Syllabusâ, style={âtextAlignâ : âcenterâ,
âcolorâ: â#503D36â,
âfont-sizeâ: 30}),
html.Div(
html.Div(id=âdummy_inputâ, style={âdisplayâ: ânoneâ}),
),
html.Br(),
html.Br(),
html.Div([
html.H1(âOverview of DEIB Elements in Syllabusâ,style={âfont-sizeâ: 30}),
html.Div(dcc.Graph(id=âbar-plotâ))
], style={âdisplayâ: âinlineâ}),
html.Br(),
html.Br(),
html.Div([
html.H1(âDetailed View of DEIB Elements in Syllabusâ, style={âfont-sizeâ: 30}),
html.Div(dcc.Graph(id=âsun-plotâ), style={âwidthâ: â100%â, âheightâ: â90vhâ})
], style={âdisplayâ: âinlineâ}),
])#callback
@app.callback([Output(component_id=âbar-plotâ, component_property=âfigureâ),
Output(component_id=âsun-plotâ, component_property=âfigureâ)],
Input(component_id=âdummy_inputâ, component_property=âchildrenâ) #dummy input
)#update graph
def update_graph(dummy):
#creating a figure for plotly graph
bar_fig=go.Figure()Category=list(df_agg_melt.Category.unique()) bar_fig=px.bar(df_agg_melt, x="Category", y="Percentage", color="Response", facet_col="Course", barmode="group", category_orders={ "Category": Category, "Response": ['Have', 'Could Include'], "Course":['PSYCH100', 'PSYCH100v2'] }) bar_fig.update_layout(width=2000, height=800) #sunburst graph sun_fig=px.sunburst(df_new, path=['Category', 'Subcategory', 'Specifics'], values='Size', color='Values', color_continuous_scale='Purpor') sun_fig.update_layout(width=2200, height=1200) return bar_fig, sun_figRun the application
if name == âmainâ:
app.run_server()
my dataframe looks like this