Hello Everyone,
Context:
I have been working on building a dashboard using FastListTemplate, where in I have inputs, button in sidebar and tabs in the main area with plots under each tabs to be displayed to the users based on the inputs selected.
Background:
To get to understanding my problem I am doing the following:
A: Initialize with empty plot
obj_plot = pn.pane.Plotly()
B: Plot generation
def distribution_plot(
df,
x_column,
y_columns,
color_names,
title,
xaxis_title,
yaxis_title,
text_format=".0f",
):
df[x_column] = df[x_column].apply(format_bin)
fig = go.Figure()
for i in range(len(y_columns)):
fig.add_trace(
go.Bar(
x=df[x_column],
y=df[y_columns[i]],
name=color_names[i],
text=df[y_columns[i]],
textposition="outside",
marker_color=px.colors.qualitative.Plotly[i],
textfont=dict(size=12),
)
)
fig.update_traces(texttemplate=f"%{{text:{text_format}}}", textposition="outside")
fig.update_layout(
barmode="group",
title=title,
xaxis_title=xaxis_title,
yaxis_title=yaxis_title,
template="plotly_dark",
width=850,
height=500,
)
return fig
my_plot = def distribution_plot(....)
obj_plot.object = my_plot
C: API call - display plot
I did A + B + C and it is a success
Problem:
- I do not want an empty plot to start with as shown in figure1
- I want to start off with blank to startwith as shown in figure2
so,
I did
A (obj_plot = None) + B + C and it is a Failure (plot does not get displayed upon api call)
Is there a way to start off with Blank(figure2) and be able to display the plot after the api call ?
Thanks.
p.s. I am relatively new panel user.