'Remove waste info from plots

in my code I use matplot package as

import matplotlib.pyplot as plt

and ipywidget package as

import ipywidgets as widgets

this is my function:

def run_LagGraph(ev): 

    clear_output()
    DisplaySeptatedButtons(2)
    fig3, (ax1) = plt.subplots(figsize=(18,10),facecolor='cornsilk', nrows=1, ncols=1)
    plt.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=0.6)

    ax1.hist(dfp.lag, bins=bins_list , alpha=0.5,edgecolor='Blue',lw=2, color='navy')

    span10=ax1.axvspan(0,0,color="Red",alpha=0.4)
    span11=ax1.axvspan(0,0,color="green",alpha=0.4)
    span12=ax1.axvspan(0,0,color="Yellow",alpha=0.4)
    span13=ax1.axvspan(0,0,color="Red",alpha=0.4)


    ax1.set_xticks(ticks_list)
    ax1.set_title(label=f"{ProjectName} \n Activities Lag Duration Distribution"
                  ,fontsize=17,
                  color="black",
                  loc="center",
                  fontstyle='italic')
    
    ax1.set_xlabel('Duration Range')
    ax1.set_ylabel('# of Activities')
    
    pdqg2=pdq.loc[pdq.index==2]
    g2str=pdqg2.at[2,'quality_note_general']

    ax1.text(0.2,-0.08,g2str, transform=fig3.transFigure, size=14)
    
    plt.close()
    
    def fun(g,y,r,r0,sy):
        span10.set_xy([[0,0],[0,1],[r0,1],[r0,0]])
        span11.set_xy([[0,0],[0,1],[g,1],[g,0]])
        span12.set_xy([[g,0],[g,1],[y,1],[y,0]])
        span13.set_xy([[y,0],[y,1],[r,1],[r,0]])
        ax1.set_xlim([r0, sy]) 
        display(fig3,span10, span11, span12, span13 )
        
    r0= widgets.IntSlider(min=-140, max=0, step=7, value=0,description = 'Red Zone:<0', layout=widgets.Layout(width="30%"))
    g= widgets.IntSlider(min=0, max=1000, step=7, value=42,description = 'Green Zone', layout=widgets.Layout(width="30%"))
    y= widgets.IntSlider(min=0, max=1000, step=7, value=84,description = 'Yellow Zone', layout=widgets.Layout(width="30%"))
    r= widgets.IntSlider(min=0, max=1000, step=7, value=140,description = 'Red Zone', layout=widgets.Layout(width="30%"))
    sy=widgets.IntSlider(min=0, max=1000, step=7, value=140,description = 'Duration Range', layout=widgets.Layout(width="30%"))
    
    sliders= widgets.HBox([r0,g,y,r,sy])
    out = widgets.interactive_output(fun, {'r0': r0,'g': g, 'y': y, 'r': r, 'sy': sy})
    
    display(sliders,out)  

you can set bins_list,ticks_list,pdqg2 and other data's anything you want.

the problem is this:

when i use this function :

widgets.interactive_output 

from ipywidgets package this notes will appear: Plot

any solution to remove these?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source