本文整理汇总了Python中matplotlib.backends.backend_agg.FigureCanvasAgg.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasAgg.__init__方法的具体用法?Python FigureCanvasAgg.__init__怎么用?Python FigureCanvasAgg.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_agg.FigureCanvasAgg
的用法示例。
在下文中一共展示了FigureCanvasAgg.__init__方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__( self, figure ):
if DEBUG: print 'FigureCanvasQtAgg: ', figure
FigureCanvasQT.__init__( self, figure )
FigureCanvasAgg.__init__( self, figure )
self.drawRect = False
self.rect = []
self.replot = True
self.pixmap = qt.QPixmap()
示例2: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__(self):
self.fig = Figure()
self.ax = self.fig.add_subplot(111)
self.ax.set_xlim(0, 10)
self.ax.set_ylim(0,10)
self.ax.set_autoscale_on(False)
FigureCanvasAgg.__init__(self, self.fig)
self.background = self.copy_from_bbox(self.ax.bbox)
示例3: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__( self, figure, parent=None):
if DEBUG: print 'FigureCanvasQtAgg: ', figure
FigureCanvasQT.__init__(self, figure, parent)
FigureCanvasAgg.__init__( self, figure )
self.drawRect = False
self.rect = []
self.replot = True
self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent)
示例4: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__(self, size = (7,3.5),
logx = False,
logy = False,
legends = True,
bw = False):
self.fig = Figure(figsize=size) #in inches
FigureCanvas.__init__(self, self.fig)
self._logX = logx
self._logY = logy
self._bw = bw
self._legend = legends
self._legendList = []
self._dataCounter = 0
if not legends:
if self._logY:
ax = self.fig.add_axes([.15, .15, .75, .8])
else:
ax = self.fig.add_axes([.15, .15, .75, .75])
else:
if self._logY:
ax = self.fig.add_axes([.15, .15, .7, .8])
else:
ax = self.fig.add_axes([.15, .15, .7, .8])
ax.set_axisbelow(True)
self.ax = ax
if self._logY:
self._axFunction = ax.semilogy
else:
self._axFunction = ax.plot
if self._bw:
self.colorList = ['k'] #only black
self.styleList = ['-', ':', '-.', '--']
self.nColors = 1
else:
self.colorList = colorlist
self.styleList = ['-', '-.', ':']
self.nColors = len(colorlist)
self.nStyles = len(self.styleList)
self.colorIndex = 0
self.styleIndex = 0
self.xmin = None
self.xmax = None
self.ymin = None
self.ymax = None
self.limitsSet = False
示例5: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__(self, figure):
QtGui.QWidget.__init__(self)
FigureCanvasAgg.__init__(self, figure)
self.figure = figure
self.setMouseTracking(True)
w,h = self.get_width_height()
self.resize( w, h )
self.drawRect = False
self.rect = []
self.replot = True
self.pixmap = QtGui.QPixmap()
示例6: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__( self, figure ):
if DEBUG: print 'FigureCanvasQtAgg: ', figure
FigureCanvasQT.__init__( self, figure )
FigureCanvasAgg.__init__( self, figure )
self.drawRect = False
self.rect = []
self.blitbox = None
self.replot = True
# JB: do NOT set QtCore.Qt.WA_OpaquePaintEvent because part of the figure is transparent.
#self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent)
# JB: added "animating" flag.
self.animating = False
示例7: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__(self, couleur_fond = 'w', dimensions = None, feuille = None):
self.figure = Figure(dpi = param.dpi_ecran, frameon=True, facecolor = couleur_fond)
FigureCanvasAgg.__init__(self, self.figure)
self.axes = self.figure.add_axes([0, 0, 1, 1], frameon=False)
self._dimensions = dimensions
self.__feuille_actuelle = feuille
self.axes.set_xticks([])
self.axes.set_yticks([])
# Ces paramètres ne sont utiles que pour les sur-classes s'intégrant dans un GUI.
self.editeur = None
self.select = None # objet couramment sélectionné
#if self.param("transformation_affine") is not None:
# self.transformation = matplotlib.transforms.Affine(*self.param("transformation_affine"))
# self.figure.set_transform(self.transformation)
# self.axes.set_transform(self.transformation)
#else:
# self.transformation = None
if self.param("transformation") is not None:
a, b, c, d = self.param("transformation")
# CODE À RÉÉCRIRE et À ADAPTER
self.transformation = numpy.matrix([[a, b], [c, d]])
else:
self.transformation = None
self._affichage_gele = False
# Ne pas utiliser directement.
# Si on met la valeur a True, self.rafraichir_affichage() ne fait plus rien.
# Cela permet d'effectuer un certain nombre d'actions rapidement,
# et de n'actualiser qu'à la fin.
# En particulier, cela sert pour charger une figure depuis un fichier .geo
self._affichage_gele_en_apparence = False
# Ne pas utiliser directement.
# Si on met la valeur a True, self.rafraichir_affichage() fonctionne toujours,
# mais les changements ne s'affichent pas à l'écran.
# Cela permet d'effectuer un certain nombre d'actions sans que l'utilisateur s'en apercoive
# (pas de clignotement de l'affichage).
# Par contre, le gain de temps est négligeable par rapport à un vrai gel de l'affichage.
# En particulier, cela sert pour exporter une figure.
self.graph = Moteur_graphique(self)
self.parametres = ["taille", "gradu", "afficher_axes", "afficher_quadrillage",
"afficher_fleches", "repere", "resolution", "origine_axes",
"utiliser_repere", "quadrillages", "couleur_papier_millimetre",
"liste_axes", "ratio", "grille_aimantee", "zoom_texte",
"zoom_ligne", "dpi_ecran"]
self.objets_en_gras = WeakSet()
self.initialiser()
示例8: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__(self, figure, master=None, resize_callback=None):
FigureCanvasAgg.__init__(self, figure)
self._idle = True
self._idle_callback = None
t1, t2, w, h = self.figure.bbox.bounds
w, h = int(w), int(h)
self._tkcanvas = Tk.Canvas(
master=master,
width=w,
height=h,
borderwidth=0,
highlightthickness=0)
self._tkphoto = Tk.PhotoImage(master=self._tkcanvas, width=w, height=h)
self._tkcanvas.create_image(w // 2, h // 2, image=self._tkphoto)
self._resize_callback = resize_callback
self._tkcanvas.bind("<Configure>", self.resize)
self._tkcanvas.bind("<Key>", self.key_press)
self._tkcanvas.bind("<Motion>", self.motion_notify_event)
self._tkcanvas.bind("<KeyRelease>", self.key_release)
for name in "<Button-1>", "<Button-2>", "<Button-3>":
self._tkcanvas.bind(name, self.button_press_event)
for name in "<Double-Button-1>", "<Double-Button-2>", "<Double-Button-3>":
self._tkcanvas.bind(name, self.button_dblclick_event)
for name in "<ButtonRelease-1>", "<ButtonRelease-2>", "<ButtonRelease-3>":
self._tkcanvas.bind(name, self.button_release_event)
# Mouse wheel on Linux generates button 4/5 events
for name in "<Button-4>", "<Button-5>":
self._tkcanvas.bind(name, self.scroll_event)
# Mouse wheel for windows goes to the window with the focus.
# Since the canvas won't usually have the focus, bind the
# event to the window containing the canvas instead.
# See http://wiki.tcl.tk/3893 (mousewheel) for details
root = self._tkcanvas.winfo_toplevel()
root.bind("<MouseWheel>", self.scroll_event_windows, "+")
# Can't get destroy events by binding to _tkcanvas. Therefore, bind
# to the window and filter.
def filter_destroy(evt):
if evt.widget is self._tkcanvas:
self.close_event()
root.bind("<Destroy>", filter_destroy, "+")
self._master = master
self._tkcanvas.focus_set()
示例9: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__(self, options):
self.options = options
# Global plot settings
mpl.rcParams['font.size'] = self.options.font_size
mpl.rcParams['axes.titlesize'] = self.options.font_size
mpl.rcParams['axes.labelsize'] = self.options.font_size
mpl.rcParams['xtick.labelsize'] = self.options.font_size
mpl.rcParams['ytick.labelsize'] = self.options.font_size
mpl.rcParams['legend.fontsize'] = self.options.font_size
mpl.rcParams['svg.fonttype'] = 'none'
self.fig = Figure(facecolor='white', dpi=options.dpi)
FigureCanvas.__init__(self, self.fig)
self.cid = None
self.type = '<none>'
self.name = '<none>'
self.axesColour = (0.5, 0.5, 0.5)
示例10: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__(self, parent, fixe = False):
"Si fixe = True, l'utilisateur ne peut pas zoomer ou recadrer la fenêtre d'affichage avec la souris."
self.parent = parent
# fenetre_principale>onglets>panel>canvas
self.fenetre_principale = self.parent.parent.parent
# initialisation dans cet ordre (self.figure doit être défini pour initialiser FigureCanvas)
Canvas.__init__(self, couleur_fond = self.param("couleur_fond"))
FigureCanvasQT.__init__(self, figure=self.figure)
# From matplotlib/backends/backend_qt5agg.py
# Calling FigureCanvasQTAggBase.__init__() directly results in a strange error.
self.setAttribute(Qt.WA_OpaquePaintEvent)
self._agg_draw_pending = False
self._bbox_queue = []
self._drawRect = None
FigureCanvasAgg.__init__(self, figure=self.figure)
##if param.plateforme == "Linux":
##self.SetSize(wx.Size(10, 10))
##elif param.plateforme == "Windows":
##self.SetWindowStyle(wx.WANTS_CHARS)
##self.Refresh()
# Message à afficher en dehors des affichages temporaires
self._message_remanent = ''
# Les modes définissent l'effet des évènements de la souris.
# Modes possibles:
# - 'defaut' (déplacer un objet),
# - 'zoom' (zoomer sur une zone),
# - 'select' (sélectionner une zone).
self.mode = "defaut"
# Action en cours :
# - None (aucune)
# - 'select' (sélection d'une zone pour export ou édition)
# - 'zoom' (sélection d'une zone pour zoomer)
# - 'shift' (translation du contenu de la fenêtre)
self.action_en_cours = None
# Rechercher les objets à proximité du pointeur
self.redetecter = True
# Objet devant être prochainement sélectionné (en cas de "litige" entre 2 objets)
self.select_memoire = None
# Étiquette couramment séléctionnée
self.etiquette_selectionnee = None
# Bloquer le zoom possible
self.fixe = fixe
# Fonction à lancer au prochain clic de souris (au lieu des actions par défaut)
self.interaction = None
# Fonction à lancer au prochain déplacement de souris (au lieu des actions par défaut)
self.interaction_deplacement = None
# Autoriser les objets à être éditer par un clic droit.
self.edition_par_clic_droit = True
# Édite les noms et étiquettes des points, textes, etc.
self.editeur = MiniEditeur(self)
# Paramètres temporaires d'affichage
self._dessin_temporaire = False
# Liste ordonnée (pour la détection) des objets de la feuille actuelle.
self.sel = []
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_IDLE, self.OnIdle)
self._timer = QTimer(self)
self._timer.timeout.connect(self._actualiser_si_necessaire)
self._timer.setInterval(100)
self.setFocusPolicy(Qt.StrongFocus)
self.setMouseTracking(True)
示例11: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__(self, figure):
FigureCanvasAgg.__init__(self, figure)