plotly-dash

UnboundLocalError: local variable 'bmi' referenced before assignment line 38

UnboundLocalError: local variable 'bmi' referenced before assignment line 38 Question: I am making a BMI calculator with plotly Dash. I’m trying to code it where the user choses the unit of the input for weight and height, however its throwing an error on line 38: UnboundLocalError: local variable ‘bmi’ referenced before assignment from dash import …

Total answers: 1

Re-using update function for 2 plotly-dash figures?

Re-using update function for 2 plotly-dash figures? Question: Context After having created a code that adds an arbitrary number of graphs in the Dash web interface, I was trying to re-use the updater function, as it is the same for each respective graph. Issue When I inspect the graph, they are both the same graph …

Total answers: 1

Bar plot in Plotly with constant spacing between random dates

Bar plot in Plotly with constant spacing between random dates Question: I am trying to create a bar plot with px.bar from plotly.express with the following code: px.bar(data_, x=’DATE’, y=’Change’) DATE is a datetime column and my issue here is that I want constant spacing between dates i.e. I want the bars to side-by-side and …

Total answers: 1

Dash With Plotly Only Updates Graph Once, But Never Again?

Dash With Plotly Only Updates Graph Once, But Never Again? Question: I’m trying to make an interactive heatmap for baseball. The input/selection is from a dropdown menu, and the output is a heatmap for that player. However, for some reason, the graph only updates once! Let me explain: If I use initial value ” for …

Total answers: 1

Plot bar chart with separate color legend – dash Plotly

Plot bar chart with separate color legend – dash Plotly Question: I’m trying to plot certain values using dash as a bar chart but use a separate column to map the colors. Using below, I’m plotting dates as a bar-chart that corresponds to a drop down bar. Is it possible to keep the dates as …

Total answers: 1

Set specific colour map to Bar-chart with callback – dash Plotly

Set specific colour map to Bar-chart with callback – dash Plotly Question: I’ve got an interactive bar chart that displays counts from days of the week. I’m trying to set the color map so each day of the week maintains the same color. At the moment, if I remove any days, the color changes. Separately, …

Total answers: 2

Return several values inside for loop

Return several values inside for loop Question: I have a function that must return several values using a for loop. I do not wish to store the values inside a list or a dict. Because of the use of the return, I only get the first value. How can I return all values successively? I …

Total answers: 2

Callback error with barchart – Plotly dash

Callback error with barchart – Plotly dash Question: I’m trying to insert an interactive bar-chart using values in a df. Using below, I’ve got the unique values from Type displayed as RadioItems. I’m aiming to link these to a bar chart within the dbc.Container. The first 5 rows of the df are displayed below. I’m …

Total answers: 1

plotly dash: two dropdowns and two dataframes

plotly dash: two dropdowns and two dataframes Question: I have a problem with dropdowns and can’t handle two DataFrames…here is my code from dash import Dash, html, dcc import plotly.express as px import numpy as np import pandas as pd import plotly.io as pio from dash.dependencies import Input, Output pio.renderers.default = "browser" raw_cut = pd.read_excel(r"C:TestTest.xlsx",) …

Total answers: 1

Display interactive metrics within dbc.Card – Dash

Display interactive metrics within dbc.Card – Dash Question: I’m aiming to include interactive counts as metrics. Specifically, insert total sums within cards that will changed depending on the variable selected from a nav bar. Using below, the Navbar is used to display the proportion of successes and failures as a pie chart. I want to …

Total answers: 1