Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
200 views
in Technique[技术] by (71.8m points)

how to delete the value out of bound in matplotlib python

I am relatively new to python. What I am trying to do is delete the values outside the bound curve in matplotlib python.

Below is the code that I am using to plot the values and bound.

def scaling(y, convert_axis, origin_axis):
    var1=(y - origin_axis[0])*(convert_axis[1]-convert_axis[0])
    var2 =(origin_axis[1]-origin_axis[0])
    var3=convert_axis[0]
    var=(var1/var2)+var3
    return var

if df['temp'] is not None:
   ax1.scatter(x=df['percent'],
               y=scaling(df['temp'], s=10, c='orange', alpha=1)
try:
    poly_y=np.poly1d(np.polyfit(df['percent'],df['temp'],3))(line_space)
    ax1.plot(line_space,
             scaling(poly_y, c='black', linestyle='--')
    ax1.fill_between(line_space,
                     scaling(poly_y -10),
                     scaling(poly_y +10),
                     color='skyblue', alpha=0.2)

I want to remove values +/-10% of outside the filled bound.

question from:https://stackoverflow.com/questions/66055573/how-to-delete-the-value-out-of-bound-in-matplotlib-python

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...