本文整理汇总了Python中plot.Plot.plot_2d_pdf方法的典型用法代码示例。如果您正苦于以下问题:Python Plot.plot_2d_pdf方法的具体用法?Python Plot.plot_2d_pdf怎么用?Python Plot.plot_2d_pdf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plot.Plot
的用法示例。
在下文中一共展示了Plot.plot_2d_pdf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Session
# 需要导入模块: from plot import Plot [as 别名]
# 或者: from plot.Plot import plot_2d_pdf [as 别名]
#.........这里部分代码省略.........
self.change_pdf_color)])
# options specific to 1D or 2D plots
subplot_1d_exists = False
subplot_2d_exists = False
subplot_2d_has_multiple_contours = False
for ax_row in self.plot.axes:
for ax in ax_row:
if hasattr(ax, 'parameters'):
if len(ax.parameters) == 1:
subplot_1d_exists = True
elif len(ax.parameters) == 2:
subplot_2d_exists = True
if len(ax.pdfs) > 1:
subplot_2d_has_multiple_contours = True
if subplot_2d_has_multiple_contours:
options.extend([('Change order of contour layers',
self.plot.change_layer_order)])
options = OrderedDict(options)
m = Menu(options=options.keys(), exit_str='Cancel')
m.get_choice()
if m.choice != m.exit:
options[m.choice]()
#self.plot.plot_grid.tight_layout(self.plot.figure)
self.plot.figure.set_tight_layout(True)
plt.draw()
def change_pdf_color(self):
pdf = self.choose_pdf()
if pdf is not None:
pdf.set_color()
if self.plot:
for ax_row in self.plot.axes:
for ax in ax_row:
subplot_pdfs = self.plot.settings \
['{0:d}.{1:d}'.format(ax.row, ax.col)] \
['pdfs']
if pdf.name in subplot_pdfs:
self.plot_constraint(ax.row, ax.col, pdf=pdf)
def plot_constraint(self, row=None, col=None, pdf=None,
parameters=None, limits=None):
if pdf is None:
pdf = self.choose_pdf(require_data=True)
if pdf is not None:
ax = self.plot.select_subplot(row=row, col=col)
if len(ax.pdfs) == 0:
self.set_up_subplot(ax.row, ax.col, pdf, parameters, limits)
if pdf.settings['color'] is None:
pdf.set_color()
n_dim = len(ax.parameters)
if n_dim == 1:
self.plot.plot_1d_pdf(ax, pdf)
elif n_dim == 2:
self.plot.plot_2d_pdf(ax, pdf)
plt.draw()
def set_up_subplot(self, row, col, pdf, parameters, limits):
ax = self.plot.axes[row][col]
ax_settings = self.plot.settings['{0:d}.{1:d}'.format(row, col)]
if parameters is None:
ax.parameters = pdf.choose_parameters()
else:
ax.parameters = parameters
if len(ax.parameters) > 2:
print 'Number of parameters must be 1 or 2.'
self.set_up_subplot(row, col, pdf, parameters, limits)
ax_settings['parameters'] = ax.parameters
self.plot.change_limits(ax=ax, limits=limits)
def pdf_exists(self):
if len(self.pdfs) > 0:
return True
else:
return False
def pdf_without_chain_exists(self):
answer = False
for pdf in self.pdfs:
if not pdf.has_mcmc():
answer = True
return answer
def pdf_with_data_exists(self):
answer = False
for pdf in self.pdfs:
if pdf.chain is not None:
answer = True
return answer
def plot_exists(self):
if self.plot:
return True
else:
return False
def plot_and_pdf_with_data_exist(self):
if self.plot and self.pdf_with_data_exists():
return True
else:
return False