(self)
Trigger an update of labels

        The method calls `get_labels` which in turn calls the widget's
        `get_label_data`. The obtained labels are shown if the corresponding
        points are selected or if `label_only_selected` is `false`.
Trigger an update of labels
Trigger an update of labels
def update_labels(self):
        """
        Trigger an update of labels

        The method calls `get_labels` which in turn calls the widget's
        `get_label_data`. The obtained labels are shown if the corresponding
        points are selected or if `label_only_selected` is `false`.
        """
        for label in self.labels:
            self.plot_widget.removeItem(label)
        self.labels = []

        mask = None
        if self.scatterplot_item is not None:
            x, y = self.scatterplot_item.getData()
            mask = self._label_mask(x, y)

        if mask is not None:
            labels = self.get_labels()
            if labels is None:
                mask = None

        self._signal_too_many_labels(
            mask is not None and mask.sum() > self.MAX_VISIBLE_LABELS)
        if self._too_many_labels or mask is None or not np.any(mask):
            return

        black = pg.mkColor(0, 0, 0)
        labels = labels[mask]
        x = x[mask]
        y = y[mask]
        for label, xp, yp in zip(labels, x, y):
            ti = TextItem(label, black)
            ti.setPos(xp, yp)
            self.plot_widget.addItem(ti)
            self.labels.append(ti)
            ti.setFont(self.parameter_setter.label_font)
def update_labels ( self ) : for label in self . labels : self . plot_widget . removeItem ( label ) self . labels = [ ] mask = None if self . scatterplot_item is not None : x , y = self . scatterplot_item . getData ( ) mask = self . _label_mask ( x , y ) if mask is not None : labels = self . get_labels ( ) if labels is None : mask = None self . _signal_too_many_labels ( mask is not None and mask . sum ( ) > self . MAX_VISIBLE_LABELS ) if self . _too_many_labels or mask is None or not np . any ( mask ) : return black = pg . mkColor ( 0 , 0 , 0 ) labels = labels [ mask ] x = x [ mask ] y = y [ mask ] for label , xp , yp in zip ( labels , x , y ) : ti = TextItem ( label , black ) ti . setPos ( xp , yp ) self . plot_widget . addItem ( ti ) self . labels . append ( ti ) ti . setFont ( self . parameter_setter . label_font )