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
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_fig
Run the application
if name == ‘main’:
app.run_server()
my dataframe looks like this