本文整理汇总了Python中Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph.rescale_data方法的典型用法代码示例。如果您正苦于以下问题:Python OWScatterPlotGraph.rescale_data方法的具体用法?Python OWScatterPlotGraph.rescale_data怎么用?Python OWScatterPlotGraph.rescale_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph
的用法示例。
在下文中一共展示了OWScatterPlotGraph.rescale_data方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OWScatterPlot
# 需要导入模块: from Orange.widgets.visualize.owscatterplotgraph import OWScatterPlotGraph [as 别名]
# 或者: from Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph import rescale_data [as 别名]
#.........这里部分代码省略.........
self.models = [self.xy_model] + g.points_models
box_plot_prop = gui.vBox(self.controlArea, "Plot Properties")
g.add_widgets([g.ShowLegend,
g.ShowGridLines,
g.ToolTipShowsAll,
g.ClassDensity,
g.RegressionLine,
g.LabelOnlySelected], box_plot_prop)
self.graph.box_zoom_select(self.controlArea)
self.controlArea.layout().addStretch(100)
self.icons = gui.attributeIconDict
p = self.graph.plot_widget.palette()
self.graph.set_palette(p)
gui.auto_commit(self.controlArea, self, "auto_send_selection",
"Send Selection", "Send Automatically")
self.graph.zoom_actions(self)
def keyPressEvent(self, event):
super().keyPressEvent(event)
self.graph.update_tooltip(event.modifiers())
def keyReleaseEvent(self, event):
super().keyReleaseEvent(event)
self.graph.update_tooltip(event.modifiers())
def reset_graph_data(self, *_):
if self.data is not None:
self.graph.rescale_data()
self.update_graph()
def _vizrank_color_change(self):
self.vizrank.initialize()
is_enabled = self.data is not None and not self.data.is_sparse() and \
len([v for v in chain(self.data.domain.variables, self.data.domain.metas)
if v.is_primitive]) > 2\
and len(self.data) > 1
self.vizrank_button.setEnabled(
is_enabled and self.graph.attr_color is not None and
not np.isnan(self.data.get_column_view(self.graph.attr_color)[0].astype(float)).all())
if is_enabled and self.graph.attr_color is None:
self.vizrank_button.setToolTip("Color variable has to be selected.")
else:
self.vizrank_button.setToolTip("")
@Inputs.data
def set_data(self, data):
self.clear_messages()
self.Information.sampled_sql.clear()
self.__timer.stop()
self.sampling.setVisible(False)
self.sql_data = None
if isinstance(data, SqlTable):
if data.approx_len() < 4000:
data = Table(data)
else:
self.Information.sampled_sql()
self.sql_data = data
data_sample = data.sample_time(0.8, no_cache=True)
data_sample.download_data(2000, partial=True)
data = Table(data_sample)
示例2: OWScatterPlot
# 需要导入模块: from Orange.widgets.visualize.owscatterplotgraph import OWScatterPlotGraph [as 别名]
# 或者: from Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph import rescale_data [as 别名]
#.........这里部分代码省略.........
)
zoom_fit = QAction(
"Fit in view", self,
shortcut=QKeySequence(Qt.ControlModifier | Qt.Key_0),
triggered=fit_to_view
)
self.addActions([zoom_in, zoom_out, zoom_fit])
def keyPressEvent(self, event):
super().keyPressEvent(event)
self.graph.update_tooltip(event.modifiers())
def keyReleaseEvent(self, event):
super().keyReleaseEvent(event)
self.graph.update_tooltip(event.modifiers())
# def settingsFromWidgetCallback(self, handler, context):
# context.selectionPolygons = []
# for curve in self.graph.selectionCurveList:
# xs = [curve.x(i) for i in range(curve.dataSize())]
# ys = [curve.y(i) for i in range(curve.dataSize())]
# context.selectionPolygons.append((xs, ys))
# def settingsToWidgetCallback(self, handler, context):
# selections = getattr(context, "selectionPolygons", [])
# for (xs, ys) in selections:
# c = SelectionCurve("")
# c.setData(xs,ys)
# c.attach(self.graph)
# self.graph.selectionCurveList.append(c)
def reset_graph_data(self, *_):
if self.data is not None:
self.graph.rescale_data()
self.update_graph()
@Inputs.data
def set_data(self, data):
self.clear_messages()
self.Information.sampled_sql.clear()
self.__timer.stop()
self.sampling.setVisible(False)
self.sql_data = None
if isinstance(data, SqlTable):
if data.approx_len() < 4000:
data = Table(data)
else:
self.Information.sampled_sql()
self.sql_data = data
data_sample = data.sample_time(0.8, no_cache=True)
data_sample.download_data(2000, partial=True)
data = Table(data_sample)
self.sampling.setVisible(True)
if self.auto_sample:
self.__timer.start()
if data is not None and (len(data) == 0 or len(data.domain) == 0):
data = None
if self.data and data and self.data.checksum() == data.checksum():
return
self.closeContext()
same_domain = (self.data and data and
data.domain.checksum() == self.data.domain.checksum())
self.data = data
self.data_metas_X = self.move_primitive_metas_to_X(data)
示例3: OWScatterPlot
# 需要导入模块: from Orange.widgets.visualize.owscatterplotgraph import OWScatterPlotGraph [as 别名]
# 或者: from Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph import rescale_data [as 别名]
#.........这里部分代码省略.........
zoom_in = QtGui.QAction(
"Zoom in", self, triggered=lambda: zoom(1.25)
)
zoom_in.setShortcuts([QtGui.QKeySequence(QtGui.QKeySequence.ZoomIn),
QtGui.QKeySequence(self.tr("Ctrl+="))])
zoom_out = QtGui.QAction(
"Zoom out", self, shortcut=QtGui.QKeySequence.ZoomOut,
triggered=lambda: zoom(1 / 1.25)
)
zoom_fit = QtGui.QAction(
"Fit in view", self,
shortcut=QtGui.QKeySequence(Qt.ControlModifier | Qt.Key_0),
triggered=fit_to_view
)
self.addActions([zoom_in, zoom_out, zoom_fit])
# def settingsFromWidgetCallback(self, handler, context):
# context.selectionPolygons = []
# for curve in self.graph.selectionCurveList:
# xs = [curve.x(i) for i in range(curve.dataSize())]
# ys = [curve.y(i) for i in range(curve.dataSize())]
# context.selectionPolygons.append((xs, ys))
# def settingsToWidgetCallback(self, handler, context):
# selections = getattr(context, "selectionPolygons", [])
# for (xs, ys) in selections:
# c = SelectionCurve("")
# c.setData(xs,ys)
# c.attach(self.graph)
# self.graph.selectionCurveList.append(c)
def reset_graph_data(self, *_):
self.graph.rescale_data()
self.update_graph()
def set_data(self, data):
self.Information.sampled_sql.clear()
self.__timer.stop()
self.sampling.setVisible(False)
self.sql_data = None
if isinstance(data, SqlTable):
if data.approx_len() < 4000:
data = Table(data)
else:
self.Information.sampled_sql()
self.sql_data = data
data_sample = data.sample_time(0.8, no_cache=True)
data_sample.download_data(2000, partial=True)
data = Table(data_sample)
self.sampling.setVisible(True)
if self.auto_sample:
self.__timer.start()
if data is not None and (len(data) == 0 or len(data.domain) == 0):
data = None
if self.data and data and self.data.checksum() == data.checksum():
return
self.closeContext()
same_domain = (self.data and data and
data.domain.checksum() == self.data.domain.checksum())
self.data = data
self.data_metas_X = self.move_primitive_metas_to_X(data)
if not same_domain:
示例4: OWScatterPlot
# 需要导入模块: from Orange.widgets.visualize.owscatterplotgraph import OWScatterPlotGraph [as 别名]
# 或者: from Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph import rescale_data [as 别名]
#.........这里部分代码省略.........
zoom_in = QtGui.QAction(
"Zoom in", self, triggered=lambda: zoom(1.25)
)
zoom_in.setShortcuts([QtGui.QKeySequence(QtGui.QKeySequence.ZoomIn),
QtGui.QKeySequence(self.tr("Ctrl+="))])
zoom_out = QtGui.QAction(
"Zoom out", self, shortcut=QtGui.QKeySequence.ZoomOut,
triggered=lambda: zoom(1 / 1.25)
)
zoom_fit = QtGui.QAction(
"Fit in view", self,
shortcut=QtGui.QKeySequence(Qt.ControlModifier | Qt.Key_0),
triggered=fit_to_view
)
self.addActions([zoom_in, zoom_out, zoom_fit])
self.graphButton.clicked.connect(self.save_graph)
# def settingsFromWidgetCallback(self, handler, context):
# context.selectionPolygons = []
# for curve in self.graph.selectionCurveList:
# xs = [curve.x(i) for i in range(curve.dataSize())]
# ys = [curve.y(i) for i in range(curve.dataSize())]
# context.selectionPolygons.append((xs, ys))
# def settingsToWidgetCallback(self, handler, context):
# selections = getattr(context, "selectionPolygons", [])
# for (xs, ys) in selections:
# c = SelectionCurve("")
# c.setData(xs,ys)
# c.attach(self.graph)
# self.graph.selectionCurveList.append(c)
def reset_graph_data(self, *_):
self.graph.rescale_data()
self.update_graph()
def set_data(self, data):
self.information(1)
if isinstance(data, SqlTable):
if data.approx_len() < 4000:
data = Table(data)
else:
self.information(1, "Data has been sampled")
data_sample = data.sample_time(1, no_cache=True)
data_sample.download_data(2000, partial=True)
data = Table(data_sample)
if data is not None and (len(data) == 0 or len(data.domain) == 0):
data = None
if self.data and data and self.data.checksum() == data.checksum():
return
self.closeContext()
same_domain = \
self.data and data and \
data.domain.checksum() == self.data.domain.checksum()
self.data = data
self.data_metas_X = self.move_primitive_metas_to_X(data)
# TODO: adapt scatter plot to work on SqlTables (avoid use of X and Y)
if isinstance(self.data, SqlTable):
self.data.download_data()
if not same_domain:
self.init_attr_values()
self.vizrank._initialize()
示例5: OWScatterPlot
# 需要导入模块: from Orange.widgets.visualize.owscatterplotgraph import OWScatterPlotGraph [as 别名]
# 或者: from Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph import rescale_data [as 别名]
#.........这里部分代码省略.........
zoom_in.setShortcuts([QtGui.QKeySequence(QtGui.QKeySequence.ZoomIn),
QtGui.QKeySequence(self.tr("Ctrl+="))])
zoom_out = QtGui.QAction(
"Zoom out", self, shortcut=QtGui.QKeySequence.ZoomOut,
triggered=lambda: zoom(1 / 1.25)
)
zoom_fit = QtGui.QAction(
"Fit in view", self,
shortcut=QtGui.QKeySequence(Qt.ControlModifier | Qt.Key_0),
triggered=fit_to_view
)
self.addActions([zoom_in, zoom_out, zoom_fit])
# self.vizrank = OWVizRank(self, self.signalManager, self.graph,
# orngVizRank.SCATTERPLOT, "ScatterPlot")
# self.optimizationDlg = self.vizrank
# def settingsFromWidgetCallback(self, handler, context):
# context.selectionPolygons = []
# for curve in self.graph.selectionCurveList:
# xs = [curve.x(i) for i in range(curve.dataSize())]
# ys = [curve.y(i) for i in range(curve.dataSize())]
# context.selectionPolygons.append((xs, ys))
# def settingsToWidgetCallback(self, handler, context):
# selections = getattr(context, "selectionPolygons", [])
# for (xs, ys) in selections:
# c = SelectionCurve("")
# c.setData(xs,ys)
# c.attach(self.graph)
# self.graph.selectionCurveList.append(c)
def reset_graph_data(self, *_):
self.graph.rescale_data()
self.major_graph_update()
def set_data(self, data):
if type(data) == SqlTable and data.approx_len() > LARGE_TABLE:
data = data.sample_time(DEFAULT_SAMPLE_TIME)
if data is not None and (len(data) == 0 or len(data.domain) == 0):
data = None
if self.data and data and self.data.checksum() == data.checksum():
return
self.closeContext()
same_domain = \
self.data and data and \
data.domain.checksum() == self.data.domain.checksum()
self.data = data
# TODO: adapt scatter plot to work on SqlTables (avoid use of X and Y)
if isinstance(self.data, SqlTable):
self.data.download_data()
# self.vizrank.clearResults()
if not same_domain:
self.init_attr_values()
self.openContext(self.data)
def set_subset_data(self, subset_data):
self.subset_data = subset_data
# self.vizrank.clearArguments()
# called when all signals are received, so the graph is updated only once
def handleNewSignals(self):
示例6: OWScatterPlot
# 需要导入模块: from Orange.widgets.visualize.owscatterplotgraph import OWScatterPlotGraph [as 别名]
# 或者: from Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotGraph import rescale_data [as 别名]
#.........这里部分代码省略.........
dlg = self.create_color_dialog()
self.graph.continuous_palette = dlg.getContinuousPalette("contPalette")
self.graph.discrete_palette = dlg.getDiscretePalette("discPalette")
p = self.graph.plot_widget.palette()
self.graph.set_palette(p)
self.zoom_select_toolbar.buttons[OWPlotGUI.SendSelection].setEnabled(
not self.auto_send_selection)
self.mainArea.setMinimumWidth(700)
self.mainArea.setMinimumHeight(550)
# self.vizrank = OWVizRank(self, self.signalManager, self.graph,
# orngVizRank.SCATTERPLOT, "ScatterPlot")
# self.optimizationDlg = self.vizrank
# def settingsFromWidgetCallback(self, handler, context):
# context.selectionPolygons = []
# for curve in self.graph.selectionCurveList:
# xs = [curve.x(i) for i in range(curve.dataSize())]
# ys = [curve.y(i) for i in range(curve.dataSize())]
# context.selectionPolygons.append((xs, ys))
# def settingsToWidgetCallback(self, handler, context):
# selections = getattr(context, "selectionPolygons", [])
# for (xs, ys) in selections:
# c = SelectionCurve("")
# c.setData(xs,ys)
# c.attach(self.graph)
# self.graph.selectionCurveList.append(c)
def reset_graph_data(self, *_):
self.graph.rescale_data()
self.major_graph_update()
def set_data(self, data: Orange.data.Table):
if data is not None and (len(data) == 0 or len(data.domain) == 0):
data = None
if self.data and data and self.data.checksum() == data.checksum():
return
self.closeContext()
same_domain = \
self.data and data and \
data.domain.checksum() == self.data.domain.checksum()
self.data = data
# TODO: adapt scatter plot to work on SqlTables (avoid use of X and Y)
if isinstance(self.data, SqlTable):
self.data.X = np.empty((len(self.data),
len(self.data.domain.attributes)))
self.data.Y = np.empty((len(self.data),
len(self.data.domain.class_vars)))
for i, row in enumerate(data):
self.data.X[i] = [row[attr]
for attr in self.data.domain.attributes]
if self.data.domain.class_vars:
self.data.Y[i] = [row[cv]
for cv in self.data.domain.class_vars]
# self.vizrank.clearResults()
if not same_domain:
self.init_attr_values()
self.openContext(self.data)