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)
我试过这个,但没有在Mac上工作
答案 0 :(得分:0)
第一行应该有一个等号代替subplot_kwn中的n:
fig, ax = plt.subplots(figsize=(16,8),dpi=100,subplot_kw= {'projection':ccrs.PlateCarree()})
您可能想要检查已导入的cartopy.crs,因为这可能会导致问题。
修改强>
所以我做了很多挖掘,发现在mng中有一个名为'full_screen_toggle'的方法,所以从理论上讲,你可以调用mng.full_screen_toggle()
后跟mng.show()
。我试过了,但这似乎没有效果。我挖掘了源代码,发现Mac OS X后端没有实现全屏功能(据我所知)。
这意味着您将不得不使用不同的后端。您可以通过调用后端是您所需后端的plt.switch_backend('backend')
来更改后端。此函数接受以下参数:
'pdf','pgf','Qt4Agg','GTK','GTKAgg','ps','agg','cairo','MacOSX','GTKCairo','WXAgg','template' ,'TkAgg','GTK3Cairo','GTK3Agg','svg','WebAgg','CocoaAgg','emf','gdk','WX'
答案 1 :(得分:0)
# -*- coding: UTF-8 -*-
'''
Created on 4 de set de 2016
@author: VladimirCostadeAlencar
'''
from numpy import arange, sin, pi
import matplotlib
matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.figure import Figure
import wx
class CanvasPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.figure = Figure()
self.axes = self.figure.add_subplot(111)
self.canvas = FigureCanvas(self, 0, self.figure)
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
self.SetSizer(self.sizer)
self.Fit()
def draw(self):
from ler_csv import ler_csv
from plotar_csv04 import plotar_pontos
nomearq = 'gps01.csv'
print 'Reading points...'
coords = ler_csv(nomearq)
figure, ax = plotar_pontos(self, coords)
print 'Plotting on Wx...'
self.canvas = FigureCanvas(self, 0, figure)
if __name__ == "__main__":
app = wx.PySimpleApp()
fr = wx.Frame(None, title='Metheoros v1.0 - 2016')
panel = CanvasPanel(fr)
panel.draw()
fr.Maximize(True)
fr.Show()
app.MainLoop()