How can I maximize my figure on matplotlib python using macOS?
<pre><code>fig, ax = plt.subplots(figsize=(16,8),dpi=100,subplot_kwn {'projection':nccrs.PlateCarree()})
ax.set_global()
plt.subplots_adjust(left=0.04, bottom=0.02, right=0.96, top=0.96)  

# set a figure window's title
fig2 = plt.gcf()
fig2.canvas.set_window_title('Metheoros 1.0')
 mng = plt.get_current_fig_manager()
 mng.Maximize(True)
</code></pre>

<p>I Tried this, but didn't work on mac</p>

<p>The first line should have an equals sign in place of the n in subplot_kwn:</p>

<pre><code>fig, ax = plt.subplots(figsize=(16,8),dpi=100,subplot_kw= {'projection':ccrs.PlateCarree()})
</code></pre>

<p>You might want to check what you have imported cartopy.crs as, because that may cause problems as well. </p>

<hr>

<p><strong>EDIT:</strong></p>

<p>So I did quite a bit of digging, and found that in mng has a method called 'full_screen_toggle', so in theory, you could call <code>mng.full_screen_toggle()</code> followed by <code>mng.show()</code>. I tried that, but that seemed to have no effect. I dug through the source code and found that the Mac OS X backend does not have a fullscreen function implemented (as far as I can tell). </p>

<p>That means that you'll have to use a different backend. You can change backends by calling <code>plt.switch_backend('backend')</code> where backend is your desired backend. This function accepts the following arguments:  </p>

<blockquote>
  <p>'pdf', 'pgf', 'Qt4Agg', 'GTK', 'GTKAgg', 'ps', 'agg', 'cairo', 'MacOSX', 'GTKCairo', 'WXAgg', 'template', 'TkAgg', 'GTK3Cairo', 'GTK3Agg', 'svg', 'WebAgg', 'CocoaAgg', 'emf', 'gdk', 'WX'</p>
</blockquote>

python osx matplotlib