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


Python plot.OWPlot类代码示例

本文整理汇总了Python中Orange.widgets.utils.plot.OWPlot的典型用法代码示例。如果您正苦于以下问题:Python OWPlot类的具体用法?Python OWPlot怎么用?Python OWPlot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了OWPlot类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, widget, parent=None, name=None):
        OWPlot.__init__(self, parent, name, axes=[], widget=widget)
        ScaleData.__init__(self)

        self.update_antialiasing(False)

        self.widget = widget
        self.last_selected_curve = None
        self.enableGridXB(0)
        self.enableGridYL(0)
        self.domain_contingencies = None
        self.auto_update_axes = 1
        self.old_legend_keys = []
        self.selection_conditions = {}
        self.attributes = []
        self.visualized_mid_labels = []
        self.attribute_indices = []
        self.valid_data = []
        self.groups = {}
        self.colors = None

        self.selected_examples = []
        self.unselected_examples = []
        self.bottom_pixmap = QPixmap(gui.resource_filename("icons/upgreenarrow.png"))
        self.top_pixmap = QPixmap(gui.resource_filename("icons/downgreenarrow.png"))
开发者ID:675801717,项目名称:orange3,代码行数:25,代码来源:owparallelgraph.py

示例2: mousePressEvent

    def mousePressEvent(self, e):
        canvas_position = self.mapToScene(e.pos())
        x = self.inv_transform(xBottom, canvas_position.x())
        contact, info = self.testArrowContact(int(round(x)), canvas_position.x(), canvas_position.y())

        if contact:
            self.pressed_arrow = info
        else:
            OWPlot.mousePressEvent(self, e)
开发者ID:r0k3,项目名称:orange3,代码行数:9,代码来源:owparallelgraph.py

示例3: set_data

 def set_data(self, data, subset_data=None, **args):
     self.start_progress()
     self.set_progress(1, 100)
     self.data = data
     self.have_data = True
     self.domain_contingencies = None
     self.groups = {}
     OWPlot.setData(self, data)
     ScaleData.set_data(self, data, subset_data, no_data=True, **args)
     self.end_progress()
开发者ID:r0k3,项目名称:orange3,代码行数:10,代码来源:owparallelgraph.py

示例4: drawCanvas

 def drawCanvas(self, painter):
     OWPlot.drawCanvas(self, painter)
     for i in range(
             int(max(0, math.floor(self.axisScaleDiv(xBottom).interval().minValue()))),
             int(min(len(self.attributes),
                     math.ceil(self.axisScaleDiv(xBottom).interval().maxValue()) + 1))):
         bottom, top = self.selection_conditions.get(self.attributes[i], (0, 1))
         painter.drawPixmap(self.transform(xBottom, i) - self.bottom_pixmap.width() / 2,
                            self.transform(yLeft, bottom), self.bottom_pixmap)
         painter.drawPixmap(self.transform(xBottom, i) - self.top_pixmap.width() / 2,
                            self.transform(yLeft, top) - self.top_pixmap.height(), self.top_pixmap)
开发者ID:r0k3,项目名称:orange3,代码行数:11,代码来源:owparallelgraph.py

示例5: mouseMoveEvent

    def mouseMoveEvent(self, e):
        if hasattr(self, "pressed_arrow"):
            canvas_position = self.mapToScene(e.pos())
            y = min(1, max(0, self.inv_transform(yLeft, canvas_position.y())))
            index, pos = self.pressed_arrow
            attr = self.data_domain[self.attributes[index]]
            old_condition = self.selection_conditions.get(attr.name, [0, 1])
            old_condition[pos] = y
            self.selection_conditions[attr.name] = old_condition
            self.update_data(self.attributes, self.visualized_mid_labels)

            if isinstance(attr, ContinuousVariable):
                val = self.attr_values[attr.name][0] + old_condition[pos] * (
                    self.attr_values[attr.name][1] - self.attr_values[attr.name][0])
                strVal = attr.name + "= %.2f" % val
                QToolTip.showText(e.globalPos(), strVal)
            if self.sendSelectionOnUpdate and self.auto_send_selection_callback:
                self.auto_send_selection_callback()

        else:
            OWPlot.mouseMoveEvent(self, e)
开发者ID:r0k3,项目名称:orange3,代码行数:21,代码来源:owparallelgraph.py

示例6: event

    def event(self, ev):
        if ev.type() == QEvent.ToolTip:
            x = self.inv_transform(xBottom, ev.pos().x())
            y = self.inv_transform(yLeft, ev.pos().y())

            canvas_position = self.mapToScene(ev.pos())
            x_float = self.inv_transform(xBottom, canvas_position.x())
            contact, (index, pos) = self.testArrowContact(int(round(x_float)), canvas_position.x(), canvas_position.y())
            if contact:
                attr = self.data_domain[self.attributes[index]]
                if isinstance(attr, ContinuousVariable):
                    condition = self.selection_conditions.get(attr.name, [0, 1])
                    val = self.attr_values[attr.name][0] + condition[pos] * (
                        self.attr_values[attr.name][1] - self.attr_values[attr.name][0]
                    )
                    str_val = attr.name + "= %%.%df" % attr.number_of_decimals % val
                    QToolTip.showText(ev.globalPos(), str_val)
            else:
                for curve in self.items():
                    if (
                        type(curve) == PolygonCurve
                        and curve.boundingRect().contains(x, y)
                        and getattr(curve, "tooltip", None)
                    ):
                        (name, value, total, dist) = curve.tooltip
                        count = sum([v[1] for v in dist])
                        if count == 0:
                            continue
                        tooltip_text = (
                            "Attribute: <b>%s</b><br>Value: <b>%s</b><br>"
                            "Total instances: <b>%i</b> (%.1f%%)<br>"
                            "Class distribution:<br>" % (name, value, count, 100.0 * count / float(total))
                        )
                        for (val, n) in dist:
                            tooltip_text += "&nbsp; &nbsp; <b>%s</b> : <b>%i</b> (%.1f%%)<br>" % (
                                val,
                                n,
                                100.0 * float(n) / float(count),
                            )
                        QToolTip.showText(ev.globalPos(), tooltip_text[:-4])

        elif ev.type() == QEvent.MouseMove:
            QToolTip.hideText()

        return OWPlot.event(self, ev)
开发者ID:mstajdohar,项目名称:orange3,代码行数:45,代码来源:owparallelgraph.py

示例7: mouseReleaseEvent

 def mouseReleaseEvent(self, e):
     if hasattr(self, "pressed_arrow"):
         del self.pressed_arrow
     else:
         OWPlot.mouseReleaseEvent(self, e)
开发者ID:r0k3,项目名称:orange3,代码行数:5,代码来源:owparallelgraph.py

示例8: set_data

 def set_data(self, data, subset_data=None, **args):
     OWPlot.setData(self, data)
     ScaleData.set_data(self, data, subset_data, **args)
     self.domain_contingencies = None
开发者ID:justin2061,项目名称:orange3,代码行数:4,代码来源:owparallelgraph.py


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