本文整理汇总了Python中pyqtgraph.graphicsItems.ScatterPlotItem.getViewBox方法的典型用法代码示例。如果您正苦于以下问题:Python ScatterPlotItem.getViewBox方法的具体用法?Python ScatterPlotItem.getViewBox怎么用?Python ScatterPlotItem.getViewBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph.graphicsItems.ScatterPlotItem
的用法示例。
在下文中一共展示了ScatterPlotItem.getViewBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OWScatterPlotGraph
# 需要导入模块: from pyqtgraph.graphicsItems import ScatterPlotItem [as 别名]
# 或者: from pyqtgraph.graphicsItems.ScatterPlotItem import getViewBox [as 别名]
#.........这里部分代码省略.........
shape_index = -1
attr_shape = self.attr_shape
if attr_shape and attr_shape != "(Same shape)" and \
len(self.data_domain[attr_shape].values) <= \
len(self.CurveSymbols):
shape_index = self.attribute_name_index[attr_shape]
return shape_index
def compute_symbols(self):
shape_index = self.get_shape_index()
if shape_index == -1:
shape_data = self.CurveSymbols[np.zeros(self.n_points, dtype=int)]
else:
shape_data = self.original_data[shape_index]
shape_data[np.isnan(shape_data)] = len(self.CurveSymbols) - 1
shape_data = self.CurveSymbols[shape_data.astype(int)]
return shape_data
def update_shapes(self):
if self.scatterplot_item:
shape_data = self.compute_symbols()
self.scatterplot_item.setSymbol(shape_data)
self.make_legend()
def update_grid(self):
self.plot_widget.showGrid(x=self.show_grid, y=self.show_grid)
def update_legend(self):
if self.legend:
self.legend.setVisible(self.show_legend)
def create_legend(self):
self.legend = LegendItem()
self.legend.setParentItem(self.plot_widget.getViewBox())
self.legend.anchor(*self.__legend_anchor)
def remove_legend(self):
if self.legend:
self.__legend_anchor = legend_anchor_pos(self.legend)
self.legend.setParent(None)
self.legend = None
if self.color_legend:
self.__color_legend_anchor = legend_anchor_pos(self.color_legend)
self.color_legend.setParent(None)
self.color_legend = None
def make_legend(self):
self.remove_legend()
self.make_color_legend()
self.make_shape_legend()
self.update_legend()
def make_color_legend(self):
color_index = self.get_color_index()
if color_index == -1:
return
color_var = self.data_domain[color_index]
use_shape = self.get_shape_index() == color_index
if isinstance(color_var, DiscreteVariable):
if not self.legend:
self.create_legend()
palette = self.discrete_palette
for i, value in enumerate(color_var.values):
color = QColor(*palette.getRGB(i))
brush = color.lighter(self.DarkerValue)
self.legend.addItem(