Need to label individual columns of a multiple bar chart

How do I label individual columns at the bottom?

For additional context:
The values in the x-axis represents the number of courses that students registered for while each individual column in a group represents the number of students that passed a particular number of courses. For example, the first blue column indicates the amount of people that passed 1 course after registering for 4 courses.

I want to label the columns by number of courses passed, i.e., I want the labels 1 2 3 4 for the first group, labels 1 2 3 for the next group and so on.

Hello constant_lynx

Why you don’t try with β€œBar Charts With Multicategory Axis Type”?

2 Likes

Hi, I appreciate the help but that is not what I want. The example you sent labels groups of columns. I want each individual column to be labeled. How do I do that?

EDIT: I have figured it out, thanks. For anyone reading this post, just change barmode to β€œgroup” and observe how the x and y arrays are rendering.

Hello constant_lynx

I created a example for you, I hope I could help you.

from dash import Dash, html, dcc

x = [
    [4, 4, 4, 4, 3, 3, 3 ,2, 2, 1],
    [1, 2, 3, 4, 1, 2, 3, 1, 2, 1]
]

app = Dash(__name__)



app.layout = html.Div([

    dcc.Graph(
 
    figure={
        'data': [
            {'x': x ,'y': [1, 2,3,4,5,6,7,9,10,11,12], 'type': 'bar', 'name': '1'},
               
        ],
        'layout': {
            'title': 'Dash Data Visualization'
        }
    }
)

])

if __name__ == '__main__':
    app.run(debug=True)

1 Like