简体   繁体   English

在 matplotlib - python 中使 x 轴和 y 轴共用零点(在限制 x 轴之后)

[英]Make zeros of x and y axes common in matplotlib - python (after limiting x axis)

I have limited x axis and due to this I get two different zeros for x and y axis, I want to make it common origin and have link drawn from it, please have a look at code and figure -我有有限的 x 轴,因此我得到了 x 和 y 轴的两个不同的零,我想让它成为共同的原点并从中绘制链接,请看一下代码和图 -

    x=[0 , flow]
    y=[0 , pressure]
    plt.plot(x,y)
    plt.xlim(0,fr_value[len(fr_value)-1])
    plt.xlabel('Flow Rate')

在此处输入图像描述

You can set ylim你可以设置 ylim

plt.ylim(bottom=0)

Sample:样本:

x=[0 , 8]
y=[0 , 9]
plt.plot(x,y)
plt.xlim(0,8)
plt.ylim(bottom=0)
plt.xlabel('Flow Rate')

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM