当前位置: 首页>>代码示例>>Python>>正文


Python ScatterPlotItem.getViewBox方法代码示例

本文整理汇总了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(
开发者ID:Micseb,项目名称:orange3,代码行数:70,代码来源:owscatterplotgraph.py


注:本文中的pyqtgraph.graphicsItems.ScatterPlotItem.getViewBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。