本文整理汇总了Python中matplotlib.backends.backend_wxagg.FigureCanvasWxAgg.get_width_height方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasWxAgg.get_width_height方法的具体用法?Python FigureCanvasWxAgg.get_width_height怎么用?Python FigureCanvasWxAgg.get_width_height使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_wxagg.FigureCanvasWxAgg
的用法示例。
在下文中一共展示了FigureCanvasWxAgg.get_width_height方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: InterpretationEditorFrame
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import get_width_height [as 别名]
#.........这里部分代码省略.........
return self.eqarea.scatter(*args,**kwargs)
def plot(self,*args,**kwargs):
# args_corrected = self.eqarea.transAxes.transform(vstack(args).T)
# x,y = args_corrected.T
return self.eqarea.plot(*args,**kwargs)
def write(self,text):
return self.eqarea.text(-1.2,1.15,text,{'family':self.font_type, 'fontsize':10*self.GUI_RESOLUTION, 'style':'normal','va':'center', 'ha':'left' })
def draw_net(self):
draw_net(self.eqarea)
def draw(self):
self.toolbar.home()
self.eqarea.set_xlim(-1., 1.)
self.eqarea.set_ylim(-1., 1.)
self.eqarea.axes.set_aspect('equal')
self.eqarea.axis('off')
self.canvas.draw()
def pan_zoom_high_equalarea(self,event):
"""
Uses the toolbar for the canvas to change the function from zoom to pan or pan to zoom
@param: event -> the wx.MouseEvent that triggered this funciton
"""
if event.LeftIsDown() or event.ButtonDClick():
return
elif self.high_EA_setting == "Zoom":
self.high_EA_setting = "Pan"
try: self.toolbar.pan('off')
except TypeError: pass
elif self.high_EA_setting == "Pan":
self.high_EA_setting = "Zoom"
try: self.toolbar.zoom()
except TypeError: pass
else:
self.high_EA_setting = "Zoom"
try: self.toolbar.zoom()
except TypeError: pass
def home_high_equalarea(self,event):
"""
returns high equal area to it's original position
@param: event -> the wx.MouseEvent that triggered the call of this function
@alters: toolbar setting
"""
self.toolbar.home()
def on_change_high_mouse_cursor(self,event):
"""
If mouse is over data point making it selectable change the shape of the cursor
@param: event -> the wx Mouseevent for that click
"""
if self.show_box.GetValue() != "specimens": return
if not self.parent.high_EA_xdata or not self.parent.high_EA_ydata: return
pos=event.GetPosition()
width, height = self.canvas.get_width_height()
pos[1] = height - pos[1]
xpick_data,ypick_data = pos
xdata_org = self.parent.high_EA_xdata
ydata_org = self.parent.high_EA_ydata
data_corrected = self.eqarea.transData.transform(vstack([xdata_org,ydata_org]).T)
xdata,ydata = data_corrected.T
xdata = list(map(float,xdata))
ydata = list(map(float,ydata))
e = 4e0
if self.high_EA_setting == "Zoom":
self.canvas.SetCursor(wx.Cursor(wx.CURSOR_CROSS))
else:
self.canvas.SetCursor(wx.Cursor(wx.CURSOR_ARROW))
for i,(x,y) in enumerate(zip(xdata,ydata)):
if 0 < sqrt((x-xpick_data)**2. + (y-ypick_data)**2.) < e:
self.canvas.SetCursor(wx.Cursor(wx.CURSOR_HAND))
break
event.Skip()
def on_equalarea_high_select(self,event):
self.parent.on_equalarea_high_select(event,fig = self.eqarea, canvas = self.canvas)
###############################Menu Functions######################################
def on_menu_help(self,event):
"""
Toggles the GUI's help mode which allows user to click on any part of the dialog and get help
@param: event -> wx.MenuEvent that triggers this function
"""
self.helper.BeginContextHelp(None)
###############################Window Functions######################################
def on_close_edit_window(self, event):
"""
the function that is triggered on the close of the interpretation editor window
@param: event -> wx.WindowEvent that triggered this function
"""
self.parent.ie_open = False
self.Destroy()
示例2: InterpretationEditorFrame
# 需要导入模块: from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg [as 别名]
# 或者: from matplotlib.backends.backend_wxagg.FigureCanvasWxAgg import get_width_height [as 别名]
#.........这里部分代码省略.........
def apply_changes(self, event):
"""
applies the changes in the various attribute boxes of this object to all highlighted fit objects in the logger, these changes are reflected both in this object and in the Zeq_GUI parent object.
@param: event -> the wx.ButtonEvent that triggered this function
"""
new_name = self.name_box.GetLineText(0)
new_color = self.color_box.GetValue()
new_tmin = self.tmin_box.GetValue()
new_tmax = self.tmax_box.GetValue()
next_i = -1
changed_i = []
while True:
next_i = self.logger.GetNextSelected(next_i)
if next_i == -1:
break
specimen = self.fit_list[next_i][1]
fit = self.fit_list[next_i][0]
if new_name:
if new_name not in map(lambda x: x.name, self.parent.pmag_results_data['specimens'][specimen]): fit.name = new_name
if new_color:
fit.color = self.color_dict[new_color]
#testing
not_both = True
if new_tmin and new_tmax:
if fit == self.parent.current_fit:
self.parent.tmin_box.SetStringSelection(new_tmin)
self.parent.tmax_box.SetStringSelection(new_tmax)
fit.put(specimen,self.parent.COORDINATE_SYSTEM, self.parent.get_PCA_parameters(specimen,fit,new_tmin,new_tmax,self.parent.COORDINATE_SYSTEM,fit.PCA_type))
not_both = False
if new_tmin and not_both:
if fit == self.parent.current_fit:
self.parent.tmin_box.SetStringSelection(new_tmin)
fit.put(specimen,self.parent.COORDINATE_SYSTEM, self.parent.get_PCA_parameters(specimen,fit,new_tmin,fit.tmax,self.parent.COORDINATE_SYSTEM,fit.PCA_type))
if new_tmax and not_both:
if fit == self.parent.current_fit:
self.parent.tmax_box.SetStringSelection(new_tmax)
fit.put(specimen,self.parent.COORDINATE_SYSTEM, self.parent.get_PCA_parameters(specimen,fit,fit.tmin,new_tmax,self.parent.COORDINATE_SYSTEM,fit.PCA_type))
changed_i.append(next_i)
offset = 0
for i in changed_i:
i -= offset
v = self.update_logger_entry(i)
if v == "s":
offset += 1
self.parent.update_selection()
###################################Canvas Functions##################################
def home_higher_equalarea(self,event):
"""
returns higher equal area to it's original position
@param: event -> the wx.MouseEvent that triggered the call of this function
@alters: toolbar setting
"""
self.toolbar.home()
def on_change_higher_mouse_cursor(self,event):
"""
If mouse is over data point making it selectable change the shape of the cursor
@param: event -> the wx Mouseevent for that click
"""
if self.show_box.GetValue() != "specimens": return
pos=event.GetPosition()
width, height = self.canvas.get_width_height()
pos[1] = height - pos[1]
xpick_data,ypick_data = pos
xdata_org = self.parent.higher_EA_xdata
ydata_org = self.parent.higher_EA_ydata
data_corrected = self.parent.high_level_eqarea.transData.transform(vstack([xdata_org,ydata_org]).T)
xdata,ydata = data_corrected.T
xdata = map(float,xdata)
ydata = map(float,ydata)
e = 4e0
if self.higher_EA_setting == "Zoom":
self.canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS))
elif self.higher_EA_setting == "Pan":
self.canvas.SetCursor(wx.StockCursor(wx.CURSOR_WATCH))
else:
self.canvas.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
if not self.parent.higher_EA_xdata or not self.parent.higher_EA_ydata: return
for i,(x,y) in enumerate(zip(xdata,ydata)):
if 0 < sqrt((x-xpick_data)**2. + (y-ypick_data)**2.) < e:
self.canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
break
###############################Window Functions######################################
def on_close_edit_window(self, event):
"""
the function that is triggered on the close of the interpretation editor window
@param: event -> wx.WindowEvent that triggered this function
"""
self.parent.interpretation_editor_open = False
self.Destroy()