Extend python plots to full screen

10,401

Solution 1

fig.set_size_inches(x_val,y_val)

helped me resize the plot to fit the screen

Solution 2

I think the size is defined by matplotlib, this means that adjusting this would result in a fullscreen plot.

From this topic: How to maximize a plt.show() window using Python

mng = plt.get_current_fig_manager()
mng.frame.Maximize(True)

Something like this might work.

Solution 3

Use window.state option to get a zoomed version:

plt.get_current_fig_manager().window.state('zoomed')
Share:
10,401
Ram
Author by

Ram

Updated on June 04, 2022

Comments

  • Ram
    Ram almost 2 years

    I want to extent the python plots I am plotting using mpld3 to full screen. I wish to use mpld3 due to the following reasons

    • I wish to have around 4 plots and have the zoom option for each plot.
    • All plots must be displayed in the same window.

    Here, I tried using tight_layout option to extend the plots to occupy full screen but it does not work as shown in the link at the end.I guess tight_layout does not work with mpld3. Is there any other way to make it stretch to full screen?

    Also,how do I add text to the screen where am plotting? Like the 4 plots occupying 90% of the screen from top to bottom and the text occupying remaining 10% at the bottom?

    import matplotlib.pyplot as plt
    import mpld3
    
    
    x = [1,2,3]
    y = [1,4,9]
    
    fig = plt.figure()
    ax = fig.add_subplot(411)
    ax.plot(x,y)
    ax = fig.add_subplot(412)
    ax.plot(x,y)
    ax = fig.add_subplot(413)
    ax.plot(x,y)
    ax = fig.add_subplot(414)
    ax.plot(x,y)
    fig.tight_layout()
    mpld3.show()