本文整理汇总了Python中matplotlib.figure.Figure.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Figure.__init__方法的具体用法?Python Figure.__init__怎么用?Python Figure.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.figure.Figure
的用法示例。
在下文中一共展示了Figure.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self, sigs={}, fig=None):
""" Instanciate a Figure.
If a signal list is provided, add a graph with the signal list
By default, create an empty list of graph and set the layout to horiz
Parameters
----------
sigs: dict of Signals
If provided, the function instanciate the Figure with one Graph and
insert the Signals
fig: Not used
Returns
-------
The figure instanciated and initialized
"""
MplFig.__init__(self)
self._layout = "horiz"
self._MODES_NAMES_TO_OBJ = {'lin':LinGraph, 'polar':PolarGraph, 'smith':SmithChart, 'eye':EyeGraph}
self._kid = None
# FIXME: Slow way... Surely there exist something faster
self._OBJ_TO_MODES_NAMES = {}
for k, v in self._MODES_NAMES_TO_OBJ.items():
self._OBJ_TO_MODES_NAMES[v] = k
if not sigs:
return
elif isinstance(sigs, dict):
self.add(sigs)
else:
print(sigs)
assert 0, _("Bad type")
示例2: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self, *args, **kwargs):
"""
custom kwarg figtitle is a figure title
"""
figtitle = kwargs.pop('figtitle', 'hi mom')
Figure.__init__(self, *args, **kwargs)
self.text(0.5, 0.95, figtitle, ha='center')
示例3: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self):
Figure.__init__(self)
self.subfigures = []
self.subplots_adjust(bottom=0.1, right=0.8)
self.dayLocator = DayLocator()
self.hourLocator = HourLocator(interval=3)
self.dateFormat = DateFormatter('%H:%M \n %Y-%m-%d')
self.set_size_inches(12, 4)
self.dirTickLocator = MultipleLocator(45)
示例4: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self, x_list, y_list, title=None):
Figure.__init__(self, facecolor="white")
ax = self.add_subplot(111)
if title is not None:
ax.set_title(title, fontsize=10)
ax.scatter(x_list, y_list)
ind = np.arange(len(x_list)) + 1
ax.set_xticks(ind)
ax.set_xlim(left=0, right=len(x_list) + 1)
示例5: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self, lat, lon, eP, cP, rMax, beta, beta1=1.5, beta2=1.4):
Figure.__init__(self)
self.R = np.array(range(1, 201), 'f')
self.lat = lat
self.lon = lon
self.rMax = rMax
self.eP = eP
self.cP = cP
self.beta = beta
self.beta1 = beta1
self.beta2 = beta2
示例6: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self, x_name, y_name, *args, **kwargs):
Figure.__init__(self, *args, **kwargs)
self.plot_axes = self.add_subplot(111, xlabel=x_name,
ylabel=y_name.upper())
self.plot_line = None
self.canvas = FigureCanvas(self)
self.plot_xname = x_name
self.plot_yname = y_name
self.plot_xdata = []
self.plot_ydata = []
self.plot_line, = self.plot_axes.plot(self.plot_xdata, self.plot_ydata)
self.plot_max_points = 200
示例7: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self, *args, **kwargs):
name = kwargs.get('name', None)
if name is not None:
del kwargs[name]
self.name = name
else:
self.name = 'figure{0}'.format(Figure.figure_index)
Figure.figure_index += 1
PLTFigure.__init__(self, *args, **kwargs)
self.axes_ = {}
self.series_ = {}
示例8: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self, **kwargs):
if "dpi" in kwargs:
dpi = kwargs["dpi"]
else:
dpi = 80
if "title" in kwargs:
title = kwargs["title"]
else:
title = None
Figure.__init__(self, figsize=(self.width / dpi, self.height / 80), dpi=dpi)
self.title = title
self.dpi = dpi
self.kwargs = kwargs
示例9: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self, *attributes):
Figure.__init__(self, (5.0, 4.0), facecolor="white")
self.attributes = attributes
self.__axes = self.add_subplot(111)
# Insert empty attributes with a dict for figure attributes
if not self.attributes:
self.attributes = [{}]
self.draw_chart()
示例10: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self, master, size, dpi, task):
Figure.__init__(
self,
figsize=(size[0] / dpi, size[1] / dpi),
dpi=dpi,
facecolor="w",
edgecolor="b",
frameon=True,
linewidth=0,
)
FigureCanvas(self, master=master)
self.master = master
self._errors = collections.OrderedDict()
self._dirty = True
self._task = task
self.add_subplot(111, axisbg="w")
示例11: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self, locking=True, disable_output=None, display=None, toolbar=None, **figkw):
if disable_output is not None:
self._disable_output = disable_output
else:
self._disable_output = _p.rcParams['refigure.disableoutput']
if display is not None:
self.display = display
else:
self.display = _p.rcParams['refigure.display']
if toolbar is not None:
self._toolbar = toolbar
else:
self._toolbar = _p.rcParams['refigure.toolbar']
if not self._toolbar and 'facecolor' not in figkw:
figkw['facecolor'] = 'white'
_Figure.__init__(self, **figkw)
c = _FigureCanvasBase(self) # For savefig to work
# Set this here to allow 'f = figure()' syntax
if not locking:
self.__class__.current_fig = self # Another thread can tweak this!
示例12: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Figure.__init__(self, *args, **kwargs)
示例13: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self):
Figure.__init__(self)
self.subfigures = []
示例14: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self, parent, width, height, dpi):
Figure.__init__(self, figsize=(width, height), dpi=dpi)
self.parent = parent
示例15: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import __init__ [as 别名]
def __init__(self, number_of_subplots):
Figure.__init__(self)
self.number_of_subplots = number_of_subplots
#todo
# there has to be an existing class that can hold four points together
# Determine how multiple plots will be laid out, 2x1, 3x4 etc.
if self.number_of_subplots <= 1:
self.num_rows = 1
self.title_fontsize = 12
self.legend_fontsize = 12
self.axes_label_fontsize = 12
self.axes_tick_fontsize = 10
self.main_border_left = 0.05
self.main_border_right = 0.05
self.main_border_lower = 0.05
self.main_border_upper = 0.05
self.subplot_border_left = 0.0
self.subplot_border_right = 0.0
self.subplot_border_lower = 0.05
self.subplot_border_upper = 0.2
elif ((self.number_of_subplots >= 2) and (self.number_of_subplots <= 6 )):
self.num_rows = 2
self.title_fontsize = 10
self.legend_fontsize = 10
self.axes_label_fontsize = 10
self.axes_tick_fontsize = 8
self.main_border_left = 0.05
self.main_border_right = 0.05
self.main_border_lower = 0.0
self.main_border_upper = 0.05
self.subplot_border_left = 0.0
self.subplot_border_right = 0.0
self.subplot_border_lower = 0.05
self.subplot_border_upper = 0.05
else:
self.num_rows = 3
self.title_fontsize = 8
self.legend_fontsize = 6
self.axes_label_fontsize = 8
self.axes_tick_fontsize = 6
self.main_border_left = 0.05
self.main_border_right = 0.05
self.main_border_lower = 0.1
self.main_border_upper = 0.0
self.subplot_border_left = 0.0
self.subplot_border_right = 0.0
self.subplot_border_lower = 0.0
self.subplot_border_upper = 0.1
self.num_cols = int(math.ceil(float(self.number_of_subplots)/float(self.num_rows)))
self.main_axes_width = 1.0 - (self.main_border_left + self.main_border_right)
self.main_axes_height = 1.0 - (self.main_border_lower + self.main_border_upper)
# Set up grid geometry
self.col_width = (self.main_axes_width/self.num_cols)
self.row_height = (self.main_axes_height/self.num_rows)
self.subplot_width = self.col_width - (self.subplot_border_left + self.subplot_border_right)
self.subplot_height = self.row_height - (self.subplot_border_lower + self.subplot_border_upper)