相关疑难解决方法(0)

如何设置'auto'作为上限,但使用matplotlib.pyplot保持固定的下限

我想将y轴的上限设置为'auto',但我想保持y轴的下限始终为零.我试过'auto'和'autorange',但那些似乎不起作用.先感谢您.

这是我的代码:

import matplotlib.pyplot as plt

def plot(results_plt,title,filename):

    ############################
    # Plot results

    # mirror result table such that each parameter forms an own data array
    plt.cla()
    #print results_plt
    XY_results = []

    XY_results = zip( *results_plt)

    plt.plot(XY_results[0], XY_results[2], marker = ".")

    plt.title('%s' % (title) )
    plt.xlabel('Input Voltage [V]')
    plt.ylabel('Input Current [mA]')

    plt.grid(True)
    plt.xlim(3.0, 4.2)  #***I want to keep these values fixed"
    plt.ylim([0, 80]) #****CHANGE**** I want to change '80' to auto, but still keep 0 as the lower limit 
    plt.savefig(path+filename+'.png')
Run Code Online (Sandbox Code Playgroud)

python matplotlib

99
推荐指数
5
解决办法
5万
查看次数

标签 统计

matplotlib ×1

python ×1