本文整理匯總了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(