[Python] How to set xlim and ylim for a subplot [duplicate]

Discussão em 'Python' iniciado por Stack, Julho 11, 2025.

  1. Stack

    Stack Membro Participativo

    I would like to limit the X and Y axis in matplotlib for a specific subplot. The subplot figure itself doesn't have any axis property. I want for example to change only the limits for the second plot:

    import matplotlib.pyplot as plt
    fig=plt.subplot(131)
    plt.scatter([1,2],[3,4])
    fig=plt.subplot(132)
    plt.scatter([10,20],[30,40])
    fig=plt.subplot(133)
    plt.scatter([15,23],[35,43])
    plt.show()

    Continue reading...

Compartilhe esta Página