Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

How to remove labels from a bar graph in Dash?

Hi,
I have a bar graph with 3 bars and I would like to remove the 3 labels on the top. How to do that ?
Thank you.

Check out the examples on bars here: https://plot.ly/python/bar-charts/
and in customizing the labels and axes here: https://plot.ly/python/axes/

Thanks, I’ve already checked them actually., but still can’t remove the labels. Spent almost 2 hours on it :sleepy:

traces.append({
‘type’ : ‘bar’,
‘y’ : data,
‘x’ : [LEGEND[feature]],
‘text’: data,
‘hoverinfo’ : ‘text’,
‘marker’ : {
‘color’ : color,
‘line’ : {‘width’ : 0,
‘color’ : ‘#444
}
},
‘name’ : cityName # disabling this.
}

For instance, here if I remove the ‘name’ attribute, I got trace1 or trace2 as a label.

Hm, I’m not sure which labels you’re referencing. If you want to remove the legend, see here: https://plot.ly/python/legend/, if you want to remove the hover labels, see here: https://plot.ly/python/text-and-annotations/#disabling-hover-text. You can also play around with this in the interactive chart maker: https://plot.ly/create and then see the values in the JSON panel on the left.

Done.
The ‘showlegend’ attribute had to be set to False in the layout section.
How did I miss that ? :blush:

1 Like