Saving Matplotlib graphs to image as full screen

后端 未结 5 2079
清酒与你
清酒与你 2020-12-01 03:54

I\'m building a small graphing utility using Pandas and MatPlotLib to parse data and output graphs from a machine at work.

When I output the graph using

<         


        
5条回答
  •  青春惊慌失措
    2020-12-01 04:32

    For everyone, who failed to save the plot in fullscreen using the above solutions, here is what really worked for me:

        figure = plt.gcf()  # get current figure
        figure.set_size_inches(32, 18) # set figure's size manually to your full screen (32x18)
        plt.savefig('filename.png', bbox_inches='tight') # bbox_inches removes extra white spaces
    

    You may also want to play with the dpi (The resolution in dots per inch)

        plt.savefig('filename.png', bbox_inches='tight', dpi=100)
    

提交回复
热议问题