[Python] why is my bar chart showing empty spaces between bars in matplotlib? [closed]

Discussão em 'Python' iniciado por Stack, Abril 23, 2025.

  1. Stack

    Stack Membro Participativo

    I’m trying to create a simple bar chart using matplotlib to visualize the number of students per department. How can I reduce the space between the bars?

    import matplotlib.pyplot as plt

    departments = ['Accounting', 'Finance', 'IT', 'Marketing']
    students = [120, 90, 150, 110]

    plt.bar(departments, students)
    plt.title("Number of Students per Department")
    plt.xlabel("Department")
    plt.ylabel("Number of Students")
    plt.show()


    [​IMG]

    Continue reading...

Compartilhe esta Página