How to use the orange3.Orange.widgets.visualize.owdistributions.DistributionBarItem function in Orange3

To help you get started, we’ve selected a few Orange3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BioDepot / BioDepot-workflow-builder / orange3 / Orange / widgets / visualize / owdistributions.py View on Github external
def help_event(self, ev):
        self.plot.mapSceneToView(ev.scenePos())
        ctooltip = []
        for vb, item in self.tooltip_items:
            mouse_over_curve = isinstance(
                item, pg.PlotCurveItem
            ) and item.mouseShape().contains(vb.mapSceneToView(ev.scenePos()))
            mouse_over_bar = isinstance(
                item, DistributionBarItem
            ) and item.boundingRect().contains(vb.mapSceneToView(ev.scenePos()))
            if mouse_over_curve or mouse_over_bar:
                ctooltip.append(item.tooltip)
        if ctooltip:
            QToolTip.showText(
                ev.screenPos(), "\n\n".join(ctooltip), widget=self.plotview
            )
            return True
        return False
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / widgets / visualize / owdistributions.py View on Github external
scvar[scvar == 0] = 1
            for i, (value, dist) in enumerate(zip(var.values, cont.T)):
                maxh = max(maxh, max(dist))
                maxrh = max(maxrh, max(dist / scvar))

            for i, (value, dist) in enumerate(zip(var.values, cont.T)):
                dsum = sum(dist)
                geom = QRectF(
                    i - 0.333, 0, 0.666, maxrh if self.relative_freq else maxh
                )
                if self.show_prob:
                    prob = dist / dsum
                    ci = 1.96 * numpy.sqrt(prob * (1 - prob) / dsum)
                else:
                    ci = None
                item = DistributionBarItem(
                    geom,
                    dist / scvar / maxrh if self.relative_freq else dist / maxh,
                    colors,
                )
                self.plot.addItem(item)
                tooltip = "\n".join(
                    "%s: %.*f" % (n, 3 if self.relative_freq else 1, v)
                    for n, v in zip(
                        cvar_values, dist / scvar if self.relative_freq else dist
                    )
                )
                item.tooltip = "{} ({}={}):\n{}".format(
                    "Normalized frequency " if self.relative_freq else "Frequency ",
                    cvar.name,
                    value,
                    tooltip,
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / widgets / visualize / owdistributions.py View on Github external
edges,
                curve,
                antialias=True,
                stepMode=False,
                fillLevel=0,
                brush=QBrush(Qt.gray),
                pen=pen,
            )
            self.plot.addItem(item)
            item.tooltip = "Density"
            self.tooltip_items.append((self.plot, item))
        else:
            bottomaxis.setTicks([list(enumerate(var.values))])
            for i, w in enumerate(dist):
                geom = QRectF(i - 0.33, 0, 0.66, w)
                item = DistributionBarItem(geom, [1.0], [QColor(128, 128, 128)])
                self.plot.addItem(item)
                item.tooltip = "Frequency for %s: %r" % (var.values[i], w)
                self.tooltip_items.append((self.plot, item))