[Python] Basic stacked data point histogram in Plotly Express

Discussão em 'Python' iniciado por Stack, Março 10, 2025.

  1. Stack

    Stack Membro Participativo

    I have such an unbelievably basic question that I can't figure out and it's making me mad.

    How can I plot a simple graph of stacked data points as X's in Plotly Express? I have tried using px.histogram but can't get it styled the way I want.

    Example sketch below. X-values 1.5 and 4 both have three observations.

    Edit to add MWE

    import pandas as pd
    import plotly.express as px

    d = {'Name':['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'],
    'Score':[1, 1.5, 4, 1.5, 1.5, 4, 2.5, 3, 2.5, 4]}

    df = pd.DataFrame(data=d)
    df

    Name Score
    0 A 1.0
    1 B 1.5
    2 C 4.0
    3 D 1.5
    4 E 1.5
    5 F 4.0
    6 G 2.5
    7 H 3.0
    8 I 2.5
    9 J 4.0


    [​IMG]

    Continue reading...

Compartilhe esta Página