Drop traces with zero values from your stacked bar charts

Hi All, How can i drop traces in my bar chart which have zeros in them and prevent them from showing in my plot? My plot loops over so many traces and some have zero values. I want to avoid them from being displayed on my plots.

Thanks

Hi @Jason4, could you please post here a minimal standalone example showing the kind of data you are having and how you create your bar chart? Since you are using Python, you can probably use function from numpy or pandas to test for zero values and include only non-zero values in the data to be plotted.

Hi @Emmanuelle. My data is being filtered using a time stamp and the result is used for ploting a Bar plot so some instances have zero values.My column has 22 features so when the zero value appear for some traces the plot looks too crowded and hard to read.

def update_graph(date1,date2):
     dff=df[str(date1):str(date2)]
     trace=[go.Bar(x=dff.index,y=dff[i],name=i) for i in dff.columns]
    return {
     'data':trace1,
     'layout':go.Layout(
          barmode='stack')}