简体   繁体   中英

Matplotlib fill between horizontal threshold line and plot

How can I fill between my plot and a horizontal line that's not zero?

I've used the fill_betwee() method and it detects the correct points but it fills all the way from the x axis to my plot

在此处输入图像描述

Here's the code that I've done so far:

plt.fill_between(df.index, df['Data'], where= (df['Data'] > 205), color='orange')

在 matplotlib 之间填充,y0:起始值,y1:结束值,其中:范围有限。

plt.fill_between(df.index, 205, df.Data, where=(df.Data > 205), color='orange')

not sure but..

add a list with the same length as df["data"] with 205 for every entry.

plt.fill_between(df.index, df['Data'], [205, 205, ...], where= (df['Data'] > 205), color='orange')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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