[Python] adding matplotlib plot directly to word document without saving image to disk first

Discussão em 'Python' iniciado por Stack, Dezembro 20, 2024.

  1. Stack

    Stack Membro Participativo

    I can add a plot generated by matpltlib to word file (using python-docx) if I save the plot as a .png file first using the following lines of code

    plt.savefig(path_to_file)

    doc.add_picture(path_to_file, width=Inches(3))


    Is there a way I can just add the plot directlty to the word document without saving as an image first. Using

    doc.add_picture(plt, width=Inches(3))


    produces a module 'matplotlib.pyplot' has no attribute 'seek' error

    Continue reading...

Compartilhe esta Página