Create the channel labels, but don't plot them yet.

        Notes
        -----
        It's necessary to have the width of the labels, so that we can adjust
        the main scene.
482125
def create_chan_labels(self):
        
        self.idx_label = []
        for one_grp in self.parent.channels.groups:
            for one_label in one_grp['chan_to_plot']:
                item = QGraphicsSimpleTextItem(one_label)
                item.setBrush(QBrush(QColor(one_grp['color'])))
                item.setFlag(QGraphicsItem.ItemIgnoresTransformations)
                self.idx_label.append(item)
790323
private void setupLabel() {
		// To retain compatibility with the WText API, create a WText for this component,
		// which gets added to the label body.
		WText textBody = new WText() {
			@Override
			public boolean isEncodeText() {
				return WHeading.this.isEncodeText();
			}

			@Override
			public String getText() {
				return WHeading.this.getText();
			}
		};

		if (label.getBody() == null) {
			label.setBody(textBody);
		} else {
			WComponent oldBody = label.getBody();

			WContainer newBody = new WContainer();
			label.setBody(newBody);

			newBody.add(textBody);
			newBody.add(oldBody);
		}
	}
873023
def make_plot(self):
        
        plot = Plot(figsize=self.figsize, dpi=self.dpi)
        ax = plot.gca(xscale='auto-gps')

        # handle user specified plot labels
        if self.args.legend:
            nlegargs = len(self.args.legend[0])
        else:
            nlegargs = 0
        if nlegargs > 0 and nlegargs != self.n_datasets:
            warnings.warn('The number of legends specified must match '
                          'the number of time series'
                          ' (channels * start times).  '
                          'There are {:d} series and {:d} legends'.format(
                            len(self.timeseries), len(self.args.legend)))
            nlegargs = 0    # don't use  them

        for i in range(0, self.n_datasets):
            series = self.timeseries[i]
            if nlegargs:
                label = self.args.legend[0][i]
            else:
                label = series.channel.name
            if self.usetex:
                label = label_to_latex(label)
            ax.plot(series, label=label)

        return plot
221706
private void addXLabels(XAxis xAxis, Number min, Number max, boolean showYLabels) {
        xAxis.setOffset(false);
        YRange v = setAxisRange(xAxis, 0, max);
        if (!showYLabels) {
        	xAxis.setLabels("");
        } else {
        	xAxis.getLabels().setColour(getHexColor(chart.getYColor()));
        	// add orientation ? (we have only for x axis in layout)
        }
    }
191372
private static Label createErrorLabel() {

        Label label = new Label();
        label.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll());
        label.addStyleName(I_CmsInputLayoutBundle.INSTANCE.inputCss().error());
        return label;
    }
336103
private void setLabelSingular(LabelGetter lg, AbstractRelation ar) {
        Labels labels = lg != null ? new Labels(lg.getLabels()) : new Labels();
        labels.setFallBack(toReadableLabel(ar.getTo().getVar()));
        ar.setLabels(labels);
    }
360073
def add_labelset(self, labelset):
        
        if not isinstance(labelset, PlotLabelset):
            self.log_exc(u"labelset must be an instance of PlotLabelset", None, True, TypeError)
        self.labelsets.append(labelset)
        self.log(u"Added labelset")
300793
def _add_labels(ax: Axes, h: Union[Histogram1D, Histogram2D], kwargs: dict):
    
    title = kwargs.pop("title", h.title)
    xlabel = kwargs.pop("xlabel", h.axis_names[0])
    ylabel = kwargs.pop("ylabel", h.axis_names[1] if len(h.axis_names) == 2 else None)

    if title:
        ax.set_title(title)
    if xlabel:
        ax.set_xlabel(xlabel)
    if ylabel:
        ax.set_ylabel(ylabel)
    ax.get_figure().tight_layout()
785690
def setup_plot(self):
        
        if self.tick_label_fontsize is not None:
            self.x_tick_label_fontsize = self.tick_label_fontsize
            self.y_tick_label_fontsize = self.tick_label_fontsize

        # setup xticks and yticks and limits
        # if logspaced, the log values are used.
        xticks = np.arange(float(self.xlims[0]),
                           float(self.xlims[1])
                           + float(self.dx),
                           float(self.dx))

        yticks = np.arange(float(self.ylims[0]),
                           float(self.ylims[1])
                           + float(self.dy),
                           float(self.dy))

        xlim = [xticks.min(), xticks.max()]
        ylim = [yticks.min(), yticks.max()]

        if self.reverse_x_axis:
                xticks = xticks[::-1]
                xlim = [xticks.max(), xticks.min()]

        if self.reverse_y_axis:
                    yticks = yticks[::-1]
                    ylim = [yticks.max(), yticks.min()]

        self.axis.set_xlim(xlim)
        self.axis.set_ylim(ylim)

        # adjust ticks for spacing. If 'wide' then show all labels, if 'tight' remove end labels.
        if self.spacing == 'wide':
            x_inds = np.arange(len(xticks))
            y_inds = np.arange(len(yticks))
        else:
            # remove end labels
            x_inds = np.arange(1, len(xticks)-1)
            y_inds = np.arange(1, len(yticks)-1)

        self.axis.set_xticks(xticks[x_inds])
        self.axis.set_yticks(yticks[y_inds])

        # set tick labels based on scale
        if self.xscale == 'log':
            self.axis.set_xticklabels([r'$10^{%i}$' % int(i)
                                      for i in xticks[x_inds]], fontsize=self.x_tick_label_fontsize)
        else:
            self.axis.set_xticklabels([r'$%.3g$' % (i)
                                      for i in xticks[x_inds]], fontsize=self.x_tick_label_fontsize)

        if self.yscale == 'log':
            self.axis.set_yticklabels([r'$10^{%i}$' % int(i)
                                      for i in yticks[y_inds]], fontsize=self.y_tick_label_fontsize)
        else:
            self.axis.set_yticklabels([r'$%.3g$' % (i)
                                      for i in yticks[y_inds]], fontsize=self.y_tick_label_fontsize)

        # add grid
        if self.add_grid:
            self.axis.grid(True, linestyle='-', color='0.75')

        # add title
        if 'title' in self.__dict__.keys():
            self.axis.set_title(r'{}'.format(self.title), **self.title_kwargs)

        if 'xlabel' in self.__dict__.keys():
            self.axis.set_xlabel(r'{}'.format(self.xlabel), **self.xlabel_kwargs)

        if 'ylabel' in self.__dict__.keys():
            self.axis.set_ylabel(r'{}'.format(self.ylabel), **self.ylabel_kwargs)
        return
544115
def set_label(label)
      if label.bytes.length > MAX_LABEL_LENGTH
        raise LabelTooLong.new("Label length in bytes must be below or equal to #{MAX_LABEL_LENGTH}")
      end
      while self.label != label
        send_message!(Protocol::Device::SetLabel.new(label: label.encode('utf-8')), wait_for: Protocol::Device::StateLabel)
      end
      self
    end
874287
def assign_node_labels_and_sizes(self):
        ""

        # shorthand
        nvals = self.ttree.get_node_values()

        # False == Hide nodes and labels unless user entered size 
        if self.style.node_labels is False:
            self.node_labels = ["" for i in nvals]           
            if self.style.node_sizes is not None:
                if isinstance(self.style.node_sizes, (list, tuple, np.ndarray)):
                    assert len(self.node_sizes) == len(self.style.node_sizes)
                    self.node_sizes = self.style.node_sizes

                elif isinstance(self.style.node_sizes, (int, str)):
                    self.node_sizes = (
                        [int(self.style.node_sizes)] * len(nvals)
                    )
                self.node_labels = [" " if i else "" for i in self.node_sizes]
                    
                    
        # True == Show nodes, label=idx, and show hover
        elif self.style.node_labels is True:
            # turn on node hover even if user did not set it explicit
            self.style.node_hover = True

            # get idx labels
            self.node_labels = self.ttree.get_node_values('idx', 1, 1)

            # use default node size as a list if not provided
            if not self.style.node_sizes:
                self.node_sizes = [18] * len(nvals)
            else:
                assert isinstance(self.style.node_sizes, (int, str))
                self.node_sizes = (
                    [int(self.style.node_sizes)] * len(nvals)
                )

        # User entered lists or other for node labels or sizes; check lengths.
        else:
            # make node labels into a list of values 
            if isinstance(self.style.node_labels, list):
                assert len(self.style.node_labels) == len(nvals)
                self.node_labels = self.style.node_labels

            # check if user entered a feature else use entered val
            elif isinstance(self.style.node_labels, str):
                self.node_labels = [self.style.node_labels] * len(nvals)
                if self.style.node_labels in self.ttree.features:
                    self.node_labels = self.ttree.get_node_values(
                        self.style.node_labels, 1, 0)

            # default to idx at internals if nothing else
            else:
                self.node_labels = self.ttree.get_node_values("idx", 1, 0)

            # make node sizes as a list; set to zero if node label is ""
            if isinstance(self.style.node_sizes, list):
                assert len(self.style.node_sizes) == len(nvals)
                self.node_sizes = self.style.node_sizes
            elif isinstance(self.style.node_sizes, (str, int, float)):
                self.node_sizes = [int(self.style.node_sizes)] * len(nvals)
            else:
                self.node_sizes = [18] * len(nvals)

            # override node sizes to hide based on node labels
            for nidx, node in enumerate(self.node_labels):
                if self.node_labels[nidx] == "":
                    self.node_sizes[nidx] = 0

        # ensure string type
        self.node_labels = [str(i) for i in self.node_labels]
554655
public void setLabelAnimator(LabelAnimator labelAnimator) {
        if (labelAnimator == null) {
            this.labelAnimator = new DefaultLabelAnimator();
        } else {
            if (this.labelAnimator != null) {
                labelAnimator.setLabelAnchored(getInputWidget(), getFloatingLabel(), this.labelAnimator.isAnchored());
            }
            this.labelAnimator = labelAnimator;
        }

        if (isInEditMode()) {
            this.labelAnimator.setLabelAnchored(getInputWidget(), getFloatingLabel(), false);
        }
    }
565906
private void initGridLabels() {
        int dim = base.getDimension();
        double[] offset = new double[dim];
        for (int j = 0; j < dim; j++) {
            if (j != index) {
                offset[j] = -(base.getUpperBounds()[j] - base.getLowerBounds()[j]) / 100;
            }
        }

        int decimal = 0;
        String label;

        gridLabels = new Label[labelsSlicing.length];

        for (int i = 0; i < gridLabels.length; i++) {

            double[] labelCoord = new double[base.getDimension()];
            System.arraycopy(base.getCoordinateSpace()[index + 1], 0, labelCoord, 0, base.getDimension());
            labelCoord[index] = labelsSlicing[i];

            if (dim == 3) {
                if (index == 0) {
                    labelCoord[2] = base.getUpperBounds()[2] - 2 * offset[2];
                } else if (index == 1) {
                    labelCoord[0] = base.getUpperBounds()[0] - 2 * offset[0];
                } else if (index == 2) {
                    labelCoord[1] = base.getUpperBounds()[1] - 2 * offset[1];
                }
            }

            decimal = base.getPrecisionDigits()[index];

            if (gridLabelStrings != null) {
                label = gridLabelStrings[i % gridLabelStrings.length];
            } else {
                String format = "%.0f";
                if (decimal < 0) {
                    format = String.format("%%.%df", -decimal);
                }
                label = String.format(format, labelsSlicing[i]);
            }

            for (int j = 0; j < dim; j++) {
                labelCoord[j] += offset[j];
            }

            if (base.getDimension() == 2) {
                if (index == 0) {
                    if (rotation == 0.0) {
                        gridLabels[i] = new Label(label, 0.5, 1.0, labelCoord);
                    } else {
                        gridLabels[i] = new Label(label, 1.0, 0.5, rotation, labelCoord);
                    }
                } else {
                    gridLabels[i] = new Label(label, 1.0, 0.5, labelCoord);
                }
            } else {
                if (index == 0) {
                    gridLabels[i] = new Label(label, 0.5, -0.5, labelCoord);
                } else if (index == 1) {
                    gridLabels[i] = new Label(label, 0.5, 1.0, labelCoord);
                } else if (index == 2) {
                    gridLabels[i] = new Label(label, 0.0, 0.5, labelCoord);
                }
            }

            gridLabels[i].setFont(gridLabelFont);
        }

        gridLabelStrings = null;
    }
1149149
function(){
    var labelType = this.config.Label.type;
    if(labelType != 'Native') {
      var that = this;
      this.graph.eachNode(function(n) { that.labels.hideLabel(n, false); });
    }
    this.compute();
    this.plot();
  }
1044506
def labels(self, include_missing=False, include_transforms_for_dims=False):
        
        return [
            dim.labels(include_missing, include_transforms_for_dims)
            for dim in self.dimensions
        ]
122626
public void setLabel(String label) {
		this.label = label;
		// if (GRAPHICS == null) return;
		bounds = METRICS.getStringBounds(getLabel(), GRAPHICS);
		boolean upsideDown = end.x < start.x;
		float dx = (float) bounds.getWidth() / 2.0f;
		float dy = (curvy < 0.0f) ^ upsideDown ? METRICS.getAscent() : -METRICS
				.getDescent();
		bounds.setRect(bounds.getX() - dx, bounds.getY() + dy, bounds
				.getWidth(), bounds.getHeight());
		//System.out.println("Setting label" + label);
	}
387722
def _set_pyqtgraph_title(layout):
    
    if 'title_size' in pytplot.tplot_opt_glob:
        size = pytplot.tplot_opt_glob['title_size']
    if 'title_text' in pytplot.tplot_opt_glob:
        if pytplot.tplot_opt_glob['title_text'] != '':
            layout.addItem(LabelItem(pytplot.tplot_opt_glob['title_text'], size=size, color='k'), row=0, col=0)
            return True
    return False