本文整理汇总了Python中matplotlib.backends.backend_wxagg.FigureCanvasWxAgg.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasWxAgg.__init__方法的具体用法?Python FigureCanvasWxAgg.__init__怎么用?Python FigureCanvasWxAgg.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_wxagg.FigureCanvasWxAgg
的用法示例。
在下文中一共展示了FigureCanvasWxAgg.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self, parent, *args, **kwargs):
"""wx.Panel with a matplotlib figure
Parameters
----------
figsize : tuple
Figure dimensions (width, height) in inches
dpi : int
Dots per inch.
facecolor : mpl color
The figure patch facecolor; defaults to rc ``figure.facecolor``
edgecolor : mpl color
The figure patch edge color; defaults to rc ``figure.edgecolor``
linewidth : scalar
The figure patch edge linewidth; the default linewidth of the frame
frameon : bool
If ``False``, suppress drawing the figure frame
subplotpars :
A :class:`SubplotParams` instance, defaults to rc
tight_layout : bool | dict
If ``False`` use ``subplotpars``; if ``True`` adjust subplot
parameters using :meth:`tight_layout` with default padding.
When providing a dict containing the keys `pad`, `w_pad`, `h_pad`
and `rect`, the default :meth:`tight_layout` paddings will be
overridden. Defaults to rc ``figure.autolayout``.
"""
self.figure = Figure(*args, **kwargs)
FigureCanvasWxAgg.__init__(self, parent, wx.ID_ANY, self.figure)
self.Bind(wx.EVT_ENTER_WINDOW, self.ChangeCursor)
示例2: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self,parent):
self.data_t = [0]
self.data_y = [0]
self.data_y2 = [0]
self.dpi = 100
self.fig = Figure((3.0, 3.0), dpi=self.dpi)
self.axes = self.fig.add_subplot(111)
pylab.setp(self.axes.get_xticklabels(), fontsize=10)
pylab.setp(self.axes.get_yticklabels(), fontsize=10)
# plot the data as a line series, and save the reference
# to the plotted line series
#
self.plot_data = self.axes.plot(
self.data_t,self.data_y,'y',
self.data_t,self.data_y2,'c',
)
ymin = -30
ymax = 30
self.axes.set_ybound(lower=ymin, upper=ymax)
self.axes.set_xlim(0, 20)
self.axes.grid(True)
FigCanvas.__init__(self, parent, -1, self.fig)
self.drawing = False
示例3: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self, parent, fixe = False):
u"Si fixe = True, l'utilisateur ne peut pas zoomer ou recadrer la fenêtre d'affichage avec la souris."
self.parent = parent
# initialisation dans cet ordre (self.figure doit être défini pour initialiser FigureCanvas)
Canvas.__init__(self, couleur_fond = self.param("couleur_fond"))
FigureCanvasWxAgg.__init__(self, parent, -1, self.figure)
if param.plateforme == "Linux":
self.SetSize(wx.Size(10, 10))
elif param.plateforme == "Windows":
self.SetWindowStyle(wx.WANTS_CHARS)
self.Refresh()
self.debut_zoom = None
# Utilisé pour zoomer avec Ctrl + Clic gauche (contiendra la position initiale)
self.debut_select = None
# Utilisé pour sélectionner simultanément plusieurs objets avec Alt + Clic gauche (pos. initiale)
self.debut_shift = None
# Utilisé pour translater le contenu de la fenêtre (position initiale)
self.redetecter = True
# Rechercher les objets à proximité du pointeur
self.select_memoire = None
# Objet devant être prochainement sélectionné (en cas de "litige" entre 2 objets)
self.etiquette_selectionnee = None # étiquette couramment séléctionnée
self.fixe = fixe
self.interaction = None
# Fonction à lancer au prochain clic de souris (au lieu des actions par défaut)
self.interaction_deplacement = None
# Fonction à lancer au prochain déplacement de souris (au lieu des actions par défaut)
self.editeur = MiniEditeur(self) # edite les noms et etiquettes des points, textes, etc.
# Paramètres temporaires d'affichage
self._dessin_temporaire = False
self.sel = []
# Liste ordonnée (pour la détection) des objets de la feuille actuelle.
self.motion_event = None
self.wheel_event_count = 0
self.wheel_ctrl_event_count = 0
self.Bind(wx.EVT_MOUSEWHEEL, self.EventOnWheel)
self.Bind(wx.EVT_MOTION, self.EventOnMotion)
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.Bind(wx.EVT_CHAR, self.OnChar)
#self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
self._pile_instructions = [] # instructions à exécuter lorsqu'aucune autre action n'est en cours. (Idle)
self.Bind(wx.EVT_IDLE, self.OnIdle)
timer=wx.Timer(self)
self.Bind(wx.EVT_TIMER, self._actualiser_si_necessaire)
timer.Start(150)
示例4: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self, parent, id,
cursor=True, crosshairs=True, rubberband=True, point=True, selection=True, zoom=True,
figpx=None, figsize=None, dpi=None):
# If no figsize is given, use figure.figsize from matplotlibrc
if figsize is None:
figsize=rcParams['figure.figsize']
# If no dpi is given, use figure.dpi from matplotlibrc
if dpi is None:
dpi=rcParams['figure.dpi']
# When given, figpx overrides figsize.
# figsize is calculated from figpx and dpi.
if figpx is not None:
figsize=(figpx[0]*1.0/dpi, figpx[1]*1.0/dpi)
FigureCanvasWxAgg.__init__(self, parent, id, Figure(figsize, dpi))
self.cursor = CursorChanger(self, cursor)
self.crosshairs = CrosshairPainter(self, crosshairs)
self.rubberband = RubberbandPainter(self, rubberband)
self.point = point
self.selection = selection
self.zoom = zoom
self.figure.set_edgecolor('black')
self.figure.set_facecolor('white')
self.SetBackgroundColour(wx.WHITE)
# Turn on repaint
self.repaintEnabled=True
# Zoom corner 1, data and wx coordinates
self.axes1 = None
self.zoom1 = None
self.point1 = None
# Axes history
self.limits=AxesLimits()
# Connect matplotlib event handlers
self.figure.canvas.mpl_connect('motion_notify_event', self.on_motion_notify_event)
self.figure.canvas.mpl_connect('button_press_event', self.on_button_press_event)
self.figure.canvas.mpl_connect('button_release_event', self.on_button_release_event)
self.figure.canvas.mpl_connect('pick_event', self.on_pick_event)
self.figure.canvas.mpl_connect('key_press_event', self.on_key_press_event)
# find the toplevel parent window and register an activation event
# handler that is keyed to the id of this PlotPanel
topwin = self._get_toplevel_parent()
# Connect wx event handlers
# topwin is a PlotFrame object - the toplevel window of a figure
topwin.Connect(self.GetId(), self.GetId(), wx.wxEVT_ACTIVATE, self.OnActivate)
wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
wx.EVT_WINDOW_DESTROY(self, self.OnDestroy)
示例5: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self, parent, figsize=(8, 6), dpi=100, facecolor='w'):
"""
figsize : (w, h)
size in inches
dpi : int
dits per inch
"""
self.figure = Figure(figsize, dpi, facecolor)
FigureCanvasWxAgg.__init__(self, parent, -1, self.figure)
self.Bind(wx.EVT_ENTER_WINDOW, self.ChangeCursor)
示例6: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self, parent, figsize=(8, 6), dpi=100):
"""
figsize : (w, h)
size in inches
dpi : int
dits per inch
"""
self.figure = Figure(figsize=figsize, dpi=dpi)
FigureCanvasWxAgg.__init__(self, parent, -1, self.figure)
self.Bind(wx.EVT_ENTER_WINDOW, self.ChangeCursor)
self.Bind(wx.EVT_MENU, self.OnFileSave, id=wx.ID_SAVE)
示例7: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self, parent, tuplNomVar):
self.fig = pl.figure() # (9,8), 90)
FigureCanvasWxAgg.__init__(self, parent, -1, self.fig)
self.xlim, self.ylim, self.dataon = (), (), False
# ion() #pour faire animation??
# c'est la GUI e tle modele
self.parent = parent
self.model = parent.model
self.traduit = parent.traduit
self.tradinverse = parent.tradinverse
# liste de GraphicObject selon les types
self.listeObject = []
# polygone d'interaction sur une zone (pour pouvoir la modifier)
self.polyInteract = None
# liste de variables, sert pour la GUI et le combobox sur les variables
self.listeNomVar = list(tuplNomVar)
self.listeNomVar.extend(["PHT3D", "Transport", "Observation", "Tr_Rech", "PH_Rech"])
self.curVar, self.curContour = None, "Charge" # variable courante selectionne
self.curLayer, self.curOri, self.curPlan, self.curGroupe = 0, "Z", 0, None
# liste des types de zones (des constantes)
self.listeNomZone = [Zone.POINT, Zone.LIGNE, Zone.RECT, Zone.POLY, Zone.POLYV]
# variable pour savoir si on est en cours de tracage d'une zone
self.typeZone = -1
# coordonnees et zone de la zone que l'on est en train de creer
self.curZone = None # objet graphique (ligne, point, rect..)
self.x1, self.y1 = [], []
self.tempZoneVal = [] # liste de valeurs pour polyV
self.calcE = 0
self.calcT = 0
self.calcR = 0
# dit si calcule effectue ou non
# dictionnaire qui est compose des variables de l'Aquifere
# a chaque variable est associe une liste de zones
self.listeZone, self.listeZoneText, self.listeZlayer = {}, {}, {}
for i in range(len(self.listeNomVar)):
# print self.listeNomVar[i]
self.listeZone[self.listeNomVar[i]] = []
self.listeZoneText[self.listeNomVar[i]] = []
self.listeZlayer[self.listeNomVar[i]] = []
# toolbar de la visu, de type NavigationToolbar2Wx
self.toolbar = NavigationToolbar2Wx(self)
self.toolbar.Realize()
# ajout du subplot a la figure
self.cnv = self.fig.add_axes([0.05, 0.05, 0.9, 0.88]) # left,bottom, wide,height
self.toolbar.update()
self.pos = self.mpl_connect("motion_notify_event", self.onPosition)
示例8: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self,parent,SetStatusCB=None):
if SetStatusCB:
self.SetStatusCB=SetStatusCB
fig = mpl.figure.Figure()
ax = fig.add_axes([0.075,0.1,0.75,0.85])
FigureCanvas.__init__(self,parent, -1, fig)
self.mpl_connect('motion_notify_event', self.OnMotion)
self.mpl_connect('button_press_event', self.OnBtnPress)
self.mpl_connect('button_release_event', self.OnBtnRelease)
self.mpl_connect('scroll_event', self.OnBtnScroll)
self.mpl_connect('key_press_event',self.OnKeyPress)
self.fig=fig
self.ax=ax
示例9: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self, parent, points, **kwargs):
'''
points -- a dictionary mapping x axis values to lists of values to plot
'''
self.figure = Figure()
FigureCanvasWxAgg.__init__(self, parent, -1, self.figure, **kwargs)
self.canvas = self.figure.canvas
self.SetMinSize((100,100))
self.figure.set_facecolor((1,1,1))
self.figure.set_edgecolor((1,1,1))
self.canvas.SetBackgroundColour('white')
self.navtoolbar = None
self.setpoints(points)
示例10: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self, parent, **kwargs):
"""keyword the same as standard init function for a FigureCanvas"""
self.figure = Figure(figsize=(6,4))
FigureCanvas.__init__(self, parent, -1, self.figure, **kwargs)
self.canvas = self.figure.canvas
#format the appearance
self.figure.set_facecolor((1,1,1))
self.figure.set_edgecolor((1,1,1))
self.canvas.SetBackgroundColour('black')
#add subplots for various things
self.fromplot = self.figure.add_axes([.05,.05,.45,.92])
self.toplot = self.figure.add_axes([.55,.05,.45,.92])
self.fromplot.set_axis_bgcolor('black')
self.toplot.set_axis_bgcolor('black')
self.fromplot.yaxis.set_major_locator(LooseMaxNLocator(nbins=5,margin=.125))
self.fromplot.xaxis.set_major_locator(LooseMaxNLocator(nbins=5,margin=.125))
示例11: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self, parent, config, **kwargs):
"""keyword the same as standard init function for a FigureCanvas"""
self.figure = Figure(figsize=(5, 9))
FigureCanvas.__init__(self, parent, -1, self.figure, **kwargs)
self.canvas = self.figure.canvas
#format the appearance
self.figure.set_facecolor((1,1,1))
self.figure.set_edgecolor((1,1,1))
self.canvas.SetBackgroundColour('white')
#add subplots for various things
self.subplot = self.figure.add_axes([.05,.5,.92,.5])
self.posone_plot = self.figure.add_axes([.1,.05,.2,.4])
self.postwo_plot = self.figure.add_axes([.37,.05,.2,.4])
self.corrplot = self.figure.add_axes([.65,.05,.25,.4])
#initialize the camera settings and mosaic settings
self.cfg=config
camera_settings=CameraSettings()
camera_settings.load_settings(config)
mosaic_settings=MosaicSettings()
mosaic_settings.load_settings(config)
#setup a blank position list
self.posList=posList(self.subplot,mosaic_settings,camera_settings)
#start with no MosaicImage
self.mosaicImage=None
#start with relative_motion on, so that keypress calls shift_selected_curved() of posList
self.relative_motion = True
#start with no toolbar and no lasso tool
self.navtoolbar = None
self.lasso = None
self.lassoLock=False
#make a sin plot just to see that things are working
#self.t = arange(0.0,3.0,0.01)
#s = sin(2*pi*self.t)
#self.subplot.plot(self.t,s)
self.canvas.mpl_connect('button_press_event', self.on_press)
self.canvas.mpl_connect('button_release_event', self.on_release)
self.canvas.mpl_connect('key_press_event', self.on_key)
示例12: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self, parent, points, bins=100, **kwargs):
self.figure = Figure()
FigureCanvasWxAgg.__init__(self, parent, -1, self.figure, **kwargs)
self.canvas = self.figure.canvas
self.SetMinSize((100,100))
self.figure.set_facecolor((1,1,1))
self.figure.set_edgecolor((1,1,1))
self.canvas.SetBackgroundColour('white')
self.subplot = self.figure.add_subplot(111)
self.gate_helper = GatingHelper(self.subplot, self)
self.navtoolbar = NavigationToolbar(self.canvas)
self.navtoolbar.Realize()
self.x_label = ''
self.log_y = False
self.x_scale = LINEAR_SCALE
self.setpoints(points, bins)
self.canvas.mpl_connect('button_release_event', self.on_release)
示例13: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self, parent, **kwargs):
self.figure = Figure()
FigureCanvasWxAgg.__init__(self, parent, -1, self.figure, **kwargs)
self.canvas = self.figure.canvas
self.SetMinSize((100,100))
self.figure.set_facecolor((1,1,1))
self.figure.set_edgecolor((1,1,1))
self.canvas.SetBackgroundColour('white')
self.subplot = self.figure.add_subplot(111)
self.gate_helper = GatingHelper(self.subplot, self)
self.navtoolbar = None
self.point_list = []
self.gridsize = 50
self.cb = None
self.x_scale = LINEAR_SCALE
self.y_scale = LINEAR_SCALE
self.color_scale = None
self.x_label = ''
self.y_label = ''
self.cmap ='jet'
self.canvas.mpl_connect('button_release_event', self.on_release)
示例14: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self, parent, dpi=100):
self.figure = Figure(dpi=dpi)
FigureCanvasWxAgg.__init__(self, parent, -1, self.figure)
self.Bind(wx.EVT_ENTER_WINDOW, self.ChangeCursor)
self.Bind(wx.EVT_MENU, self.OnFileSave, id=wx.ID_SAVE)
示例15: __init__
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import __init__ [as 别名]
def __init__(self, *args, **kwargs):
"""
初期化
"""
FigureCanvasWxAgg.__init__(self, *args, **kwargs)
self.__drawn = 0