[Python] How to change legend fontsize with matplotlib.pyplot

Discussão em 'Python' iniciado por Stack, Agosto 18, 2025.

  1. Stack

    Stack Membro Participativo

    Simple question here: I'm trying to get the size of my legend using matplotlib.pyplot to be smaller (i.e., the text to be smaller). The code I'm using goes something like this:

    plot.figure()
    plot.scatter(k, sum_cf, color='black', label='Sum of Cause Fractions')
    plot.scatter(k, data[:, 0], color='b', label='Dis 1: cf = .6, var = .2')
    plot.scatter(k, data[:, 1], color='r', label='Dis 2: cf = .2, var = .1')
    plot.scatter(k, data[:, 2], color='g', label='Dis 3: cf = .1, var = .01')
    plot.legend(loc=2)

    Continue reading...

Compartilhe esta Página