本文整理汇总了Python中Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph.clear_selection方法的典型用法代码示例。如果您正苦于以下问题:Python OWScatterPlotGraph.clear_selection方法的具体用法?Python OWScatterPlotGraph.clear_selection怎么用?Python OWScatterPlotGraph.clear_selection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph
的用法示例。
在下文中一共展示了OWScatterPlotGraph.clear_selection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OWScatterPlot
# 需要导入模块: from Orange.widgets.visualize.owscatterplotgraph import OWScatterPlotGraph [as 别名]
# 或者: from Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph import clear_selection [as 别名]
#.........这里部分代码省略.........
self.cb_attr_color.addItem("(Same color)")
self.cb_attr_label.clear()
self.cb_attr_label.addItem("(No labels)")
self.cb_attr_shape.clear()
self.cb_attr_shape.addItem("(Same shape)")
self.cb_attr_size.clear()
self.cb_attr_size.addItem("(Same size)")
if not self.data:
return
for var in self.data.domain.metas:
self.cb_attr_label.addItem(self.icons[var], var.name)
for attr in self.data.domain.variables:
self.cb_attr_x.addItem(self.icons[attr], attr.name)
self.cb_attr_y.addItem(self.icons[attr], attr.name)
self.cb_attr_color.addItem(self.icons[attr], attr.name)
if isinstance(attr, DiscreteVariable):
self.cb_attr_shape.addItem(self.icons[attr], attr.name)
else:
self.cb_attr_size.addItem(self.icons[attr], attr.name)
self.cb_attr_label.addItem(self.icons[attr], attr.name)
self.attr_x = self.cb_attr_x.itemText(0)
if self.cb_attr_y.count() > 1:
self.attr_y = self.cb_attr_y.itemText(1)
else:
self.attr_y = self.cb_attr_y.itemText(0)
if self.data.domain.class_var:
self.graph.attr_color = self.data.domain.class_var.name
else:
self.graph.attr_color = ""
self.graph.attr_shape = ""
self.graph.attr_size = ""
self.graph.attr_label = ""
def major_graph_update(self, attributes=None, inside_colors=None, **args):
self.graph.clear_selection()
self.update_graph(attributes, inside_colors, **args)
def update_graph(self, attributes=None, inside_colors=None, **_):
self.graph.zoomStack = []
if not self.graph.have_data:
return
if attributes and len(attributes) == 2:
self.attr_x, self.attr_y = attributes
self.graph.inside_colors = inside_colors or self.outlier_values
self.graph.update_data(self.attr_x, self.attr_y)
def saveSettings(self):
OWWidget.saveSettings(self)
# self.vizrank.saveSettings()
def selection_changed(self):
self.zoom_select_toolbar.buttons[OWPlotGUI.SendSelection].setEnabled(
not self.auto_send_selection)
if self.auto_send_selection:
self.send_selections()
def set_colors(self):
dlg = self.create_color_dialog()
if dlg.exec_():
self.color_settings = dlg.getColorSchemas()
self.selected_schema_index = dlg.selectedSchemaIndex
self.graph.continuous_palette = dlg.getContinuousPalette("contPalette")
self.graph.discrete_palette = dlg.getDiscretePalette("discPalette")
self.update_graph()
def create_color_dialog(self):
c = ColorPaletteDlg(self, "Color Palette")
c.createDiscretePalette("discPalette", "Discrete Palette")
c.createContinuousPalette("contPalette", "Continuous Palette")
c.setColorSchemas(self.color_settings, self.selected_schema_index)
return c
def closeEvent(self, ce):
# self.vizrank.close()
super().closeEvent(ce)
def sendReport(self):
self.startReport(
"%s [%s - %s]" % (self.windowTitle(), self.attr_x, self.attr_y))
self.reportSettings(
"Visualized attributes",
[("X", self.attr_x),
("Y", self.attr_y),
self.graph.attr_color and ("Color", self.graph.attr_color),
self.graph.attr_label and ("Label", self.graph.attr_label),
self.graph.attr_shape and ("Shape", self.graph.attr_shape),
self.graph.attr_size and ("Size", self.graph.attr_size)])
self.reportSettings(
"Settings",
[("Symbol size", self.graph.point_width),
("Opacity", self.graph.alpha_value),
("Jittering", self.graph.jitter_size),
("Jitter continuous attributes",
gui.YesNo[self.graph.jitter_continuous])])
self.reportSection("Graph")
self.reportImage(self.graph.save_to_file, QSize(400, 400))