本文整理汇总了Python中Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph.set_domain方法的典型用法代码示例。如果您正苦于以下问题:Python OWScatterPlotGraph.set_domain方法的具体用法?Python OWScatterPlotGraph.set_domain怎么用?Python OWScatterPlotGraph.set_domain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph
的用法示例。
在下文中一共展示了OWScatterPlotGraph.set_domain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OWScatterPlot
# 需要导入模块: from Orange.widgets.visualize.owscatterplotgraph import OWScatterPlotGraph [as 别名]
# 或者: from Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph import set_domain [as 别名]
#.........这里部分代码省略.........
if self.attribute_selection_list and self.graph.domain is not None and \
all(attr in self.graph.domain
for attr in self.attribute_selection_list):
self.attr_x = self.attribute_selection_list[0]
self.attr_y = self.attribute_selection_list[1]
self.attribute_selection_list = None
self.update_graph()
self.cb_class_density.setEnabled(self.graph.can_draw_density())
self.cb_reg_line.setEnabled(self.graph.can_draw_regresssion_line())
if self.data is not None and self.__pending_selection_restore is not None:
self.apply_selection(self.__pending_selection_restore)
self.__pending_selection_restore = None
self.unconditional_commit()
def apply_selection(self, selection):
"""Apply `selection` to the current plot."""
if self.data is not None:
self.graph.selection = np.zeros(len(self.data), dtype=np.uint8)
self.selection_group = [x for x in selection if x[0] < len(self.data)]
selection_array = np.array(self.selection_group).T
self.graph.selection[selection_array[0]] = selection_array[1]
self.graph.update_colors(keep_colors=True)
@Inputs.features
def set_shown_attributes(self, attributes):
if attributes and len(attributes) >= 2:
self.attribute_selection_list = attributes[:2]
else:
self.attribute_selection_list = None
def init_attr_values(self):
data = self.data
domain = data.domain if data and len(data) else None
self.xy_model.set_domain(domain)
self.attr_x = self.xy_model[0] if self.xy_model else None
self.attr_y = self.xy_model[1] if len(self.xy_model) >= 2 \
else self.attr_x
self.graph.set_domain(data)
def set_attr(self, attr_x, attr_y):
self.attr_x, self.attr_y = attr_x, attr_y
self.update_attr()
def update_attr(self):
self.update_graph()
self.cb_class_density.setEnabled(self.graph.can_draw_density())
self.cb_reg_line.setEnabled(self.graph.can_draw_regresssion_line())
self.send_features()
def update_colors(self):
self._vizrank_color_change()
self.cb_class_density.setEnabled(self.graph.can_draw_density())
def update_density(self):
self.update_graph(reset_view=False)
def update_regression_line(self):
self.update_graph(reset_view=False)
def update_graph(self, reset_view=True, **_):
self.graph.zoomStack = []
if self.graph.data is None:
return
self.graph.update_data(self.attr_x, self.attr_y, reset_view)
def selection_changed(self):