setting y-axis limit in matplotlib

后端 未结 9 1723
自闭症患者
自闭症患者 2020-11-22 15:42

I need help with setting the limits of y-axis on matplotlib. Here is the code that I tried, unsuccessfully.

import matplotlib.pyplot as plt

plt.figure(1, fi         


        
9条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 16:33

    Just for fine tuning. If you want to set only one of the boundaries of the axis and let the other boundary unchanged, you can choose one or more of the following statements

    plt.xlim(right=xmax) #xmax is your value
    plt.xlim(left=xmin) #xmin is your value
    plt.ylim(top=ymax) #ymax is your value
    plt.ylim(bottom=ymin) #ymin is your value
    

    Take a look at the documentation for xlim and for ylim

提交回复
热议问题