dog_breeds_web_app/util.py
def convert_plt2png(plt_fig):
    """
    Make Matplotlib write to BytesIO file object and grab return the object's string
    Parameters:
        plt_fig: matplotlib figure
    Return:
        figdata_png: extract string (stream of bytes)
    """
    #Matplotlib write the PNG data to the BytesIO buffer
    buf = BytesIO() # create the buffer
    plt_fig.savefig(buf, format='png') # save figure to the buffer
    buf.seek(0) # rewind your buffer
    figdata_png = buf.getvalue()  # extract string (stream of bytes)

    return figdata_png

    Make Matplotlib write to BytesIO file object and grab return the object's string
    Parameters:
        plt_fig: matplotlib figure
    Return:
        figdata_png: extract string (stream of bytes)
    
Make Matplotlib write to BytesIO file object and grab return the object's string
Make Matplotlib write to BytesIO file object and grab return the object ' s string
def convert_plt2png(plt_fig):
    buf = BytesIO() 
    plt_fig.savefig(buf, format='png') 
    buf.seek(0) 
    figdata_png = buf.getvalue()  
    return figdata_png
def convert_plt2png ( plt_fig ) : buf = BytesIO ( ) plt_fig . savefig ( buf , format = 'png' ) buf . seek ( 0 ) figdata_png = buf . getvalue ( ) return figdata_png
Make Matplotlib write to BytesIO file object and grab return the object's string
Make Matplotlib write to BytesIO file object and grab return the object ' s string
"""
    Make Matplotlib write to BytesIO file object and grab return the object's string
    Parameters:
        plt_fig: matplotlib figure
    Return:
        figdata_png: extract string (stream of bytes)
    """ #Matplotlib write the PNG data to the BytesIO buffer # create the buffer # save figure to the buffer # rewind your buffer # extract string (stream of bytes)
plt_fig
None