[Python] PlotlyExpress not generating bar chart properly

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

  1. Stack

    Stack Membro Participativo

    I am trying to create a basic plotly chart:

    import numpy as np
    df = pd.DataFrame({"college_name":list("ABCD"),"in-state_tuition":np.random.randint(5000,7000,4),"out-of-state_tuition":np.random.randint(8000,15000,4)})

    px.bar(
    data_frame = df,
    x = "college_name",
    y = ["in-state_tuition","out-of-state_tuition"],
    opacity = 0.9,
    orientation = "v",
    barmode = 'group',
    title='Annual In-State Tuition vs Out-of-state Tuition',
    )


    but the result is incorrect, as it returns me bar chart of the same height: [​IMG]

    I got the example from : https://plotly.com/python/bar-charts/

    I am using the following versions: plotly: 6.1.2 numpy: 1.23.5

    Continue reading...

Compartilhe esta Página