[Python] Matplotlib: Display value next to each point on chart

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

  1. Stack

    Stack Membro Participativo

    Is it possible to display each point's value next to it on chart diagram:

    [​IMG]

    Values shown on points are: [7, 57, 121, 192, 123, 240, 546]

    values = list(map(lambda x: x[0], result)) #[7, 57, 121, 192, 123, 240, 546]
    labels = list(map(lambda x: x[1], result)) #['1950s', '1960s', '1970s', '1980s', '1990s', '2000s', '2010s']

    plt.plot(labels, values, 'bo')
    plt.show()


    Here's my current code for this chart.

    I would like to know each point value shown on graph, currently I can only predict values based on y-axis.

    Continue reading...

Compartilhe esta Página