✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

dcc.Graph - Overlapping X-Axis Labels and Coloring Individual Bars

Hello, everyone, I am using the amazing dash package dash to create beautiful graphs in python, while I come across a small problem here:

I am using the basic bar figure to visualize some data, while the x-axis label is somewhat partially invisible (the example here should contain the year-month information, while the labels are somewhat cut in the middle), which would cause some confusions in reading the graph, is there any method to deal with that?

Besides, I am also interested in changing the font and the color of bars depending on whether positive or negative, what could I do about that?


For the overlapping x-axis labels, try increasing the bottom margin with:

figure = {
    data: [...],
    layout: {...., 'margin': {'b': 50, 'r': 10, 'l': 30', 't': 10}}
1 Like

Check out the example on “Customizing Individual Bar Colors” here: https://plot.ly/python/bar-charts/#customizing-individual-bar-colors