Write label at plot coordinates (x,y)
498489
def label(self,x,y,label,offset=[0,0]):
        """"""
        (xc,yc)=self.p2c([x,y])
        return self.create_text(xc-offset[0],yc-offset[1],text=label)
128877
def do_label(self):
        
        outputdict = self.outputdict
        xlabel_options = self.kwargs.get("xlabel_options", {})
        self.subplot.set_xlabel(
            self.kwargs.get("xlabel", "").format(**outputdict),
            **xlabel_options)
        ylabel_options = self.kwargs.get("ylabel_options", {})
        self.subplot.set_ylabel(
            self.kwargs.get("ylabel", "").format(**outputdict),
            **ylabel_options)
        suptitle = self.kwargs.get("suptitle", None)
        if suptitle is not None:
            suptitle_options = self.kwargs.get("suptitle_options", {})
            self.figure.suptitle(
                suptitle.format(**outputdict),
                fontsize=int(self.kwargs.get("suptitle_fontsize", 15)),
                **suptitle_options)
        title = self.kwargs.get("title", None)
        if title is not None:
            title_options = self.kwargs.get("title_options", {})
            self.subplot.set_title(
                title.format(**outputdict),
                fontsize=int(self.kwargs.get("title_fontsize", 12)),
                **title_options)
        xlim = self.kwargs.get("xlim", None)
        ylim = self.kwargs.get("ylim", None)
        if xlim is not None:
            self.subplot.set_xlim(xlim)
        if ylim is not None:
            self.subplot.set_ylim(ylim)
        # axis format
        self.subplot.ticklabel_format(
            style="sci", useOffset=False,
            scilimits=self.kwargs.get("scilimits", (-4, 4))
        )
        return self
98170
def write_lines(label, lines):
    '''

    '''
    result = []
    continued = False
    for line in lines:
        if continued:
            result.append(line)
        else:
            result.append('%s %s' %(label, line))
        continued = False
        if line.endswith('\\'):
            continued = True
            
    return result
774816
def label(value, increment)
      label = if increment
                if increment >= 10 || (increment * 1) == (increment * 1).to_i.to_f
                  sprintf('%0i', value)
                elsif increment >= 1.0 || (increment * 10) == (increment * 10).to_i.to_f
                  sprintf('%0.1f', value)
                elsif increment >= 0.1 || (increment * 100) == (increment * 100).to_i.to_f
                  sprintf('%0.2f', value)
                elsif increment >= 0.01 || (increment * 1000) == (increment * 1000).to_i.to_f
                  sprintf('%0.3f', value)
                elsif increment >= 0.001 || (increment * 10000) == (increment * 10000).to_i.to_f
                  sprintf('%0.4f', value)
                else
                  value.to_s
                end
              elsif (@spread.to_f % (@marker_count.to_f==0 ? 1 : @marker_count.to_f) == 0) || !@y_axis_increment.nil?
                value.to_i.to_s
              elsif @spread > 10.0
                sprintf('%0i', value)
              elsif @spread >= 3.0
                sprintf('%0.2f', value)
              else
                value.to_s
              end

      parts = label.split('.')
      parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{THOUSAND_SEPARATOR}")
      parts.join('.')
    end
919370
def node_labels(node_labels, node_indices):
    """"""
    if len(node_labels) != len(node_indices):
        raise ValueError("Labels {0} must label every node {1}.".format(
            node_labels, node_indices))

    if len(node_labels) != len(set(node_labels)):
        raise ValueError("Labels {0} must be unique.".format(node_labels))
553828
def _y_axis(self, draw_axes=True):
        """"""
        if not self._y_labels or not self.show_y_labels:
            return

        axis = self.svg.node(self.nodes['plot'], class_="axis y web")

        for label, r in reversed(self._y_labels):
            major = r in self._y_labels_major
            if not (self.show_minor_y_labels or major):
                continue
            guides = self.svg.node(
                axis,
                class_='%sguides' %
                ('logarithmic ' if self.logarithmic else '')
            )
            if self.show_y_guides:
                self.svg.line(
                    guides, [self.view((r, theta)) for theta in self._x_pos],
                    close=True,
                    class_='%sguide line' % ('major ' if major else '')
                )
            x, y = self.view((r, self._x_pos[0]))
            x -= 5
            text = self.svg.node(
                guides, 'text', x=x, y=y, class_='major' if major else ''
            )
            text.text = label

            if self.y_label_rotation:
                text.attrib[
                    'transform'
                ] = "rotate(%d %f %f)" % (self.y_label_rotation, x, y)

            self.svg.node(
                guides,
                'title',
            ).text = self._y_format(r)
273994
def _y_axis(self):
        """"""
        if not self._y_labels or not self.show_y_labels:
            return

        axis = self.svg.node(
            self.nodes['plot'],
            class_="axis y%s" % (' always_show' if self.show_y_guides else '')
        )

        if (0 not in [label[1] for label in self._y_labels]
                and self.show_y_guides):
            self.svg.node(
                axis,
                'path',
                d='M%f %f h%f' % (
                    0, 0 if self.inverse_y_axis else self.view.height,
                    self.view.width
                ),
                class_='line'
            )

        for label, position in self._y_labels:
            if self.horizontal:
                major = label in self._y_labels_major
            else:
                major = position in self._y_labels_major

            if not (self.show_minor_y_labels or major):
                continue
            guides = self.svg.node(
                axis,
                class_='%sguides' %
                ('logarithmic ' if self.logarithmic else '')
            )
            x = -5
            y = self.view.y(position)
            if not y:
                continue
            if self.show_y_guides:
                self.svg.node(
                    guides,
                    'path',
                    d='M%f %f h%f' % (0, y, self.view.width),
                    class_='%s%s%sline' % (
                        'axis ' if label == "0" else '', 'major '
                        if major else '', 'guide ' if position != 0 else ''
                    )
                )
            text = self.svg.node(
                guides,
                'text',
                x=x,
                y=y + .35 * self.style.label_font_size,
                class_='major' if major else ''
            )

            text.text = label

            if self.y_label_rotation:
                text.attrib['transform'] = "rotate(%d %f %f)" % (
                    self.y_label_rotation, x, y
                )
                if 90 < self.y_label_rotation < 270:
                    text.attrib['class'] = ' '.join((
                        text.attrib['class']
                        and text.attrib['class'].split(' ') or []
                    ) + ['backwards'])
            self.svg.node(
                guides,
                'title',
            ).text = self._y_format(position)

        if self._y_2nd_labels:
            secondary_ax = self.svg.node(self.nodes['plot'], class_="axis y2")
            for label, position in self._y_2nd_labels:
                major = position in self._y_labels_major
                if not (self.show_minor_y_labels or major):
                    continue
                # it is needed, to have the same structure as primary axis
                guides = self.svg.node(secondary_ax, class_='guides')
                x = self.view.width + 5
                y = self.view.y(position)
                text = self.svg.node(
                    guides,
                    'text',
                    x=x,
                    y=y + .35 * self.style.label_font_size,
                    class_='major' if major else ''
                )
                text.text = label
                if self.y_label_rotation:
                    text.attrib['transform'] = "rotate(%d %f %f)" % (
                        self.y_label_rotation, x, y
                    )
                    if 90 < self.y_label_rotation < 270:
                        text.attrib['class'] = ' '.join((
                            text.attrib['class']
                            and text.attrib['class'].split(' ') or []
                        ) + ['backwards'])
17545
def text(self, x, y, text, attr=None):
        '''
        self.pos(x, y)
        self.write_color(text, attr)
1103640
def _plot(self, xticks=[], yticks=[], minor_xticks=[], minor_yticks=[],
              xlabel='Longitude', ylabel='Latitude', ax=None, ax2=None,
              colorbar=None, cb_orientation=None, cb_label=None, grid=False,
              axes_labelsize=None, tick_labelsize=None, **kwargs):
        """"""

        if ax is None:
            if colorbar is True:
                if cb_orientation == 'horizontal':
                    scale = 0.67
                else:
                    scale = 0.5
            else:
                scale = 0.55
            figsize = (_mpl.rcParams['figure.figsize'][0],
                       _mpl.rcParams['figure.figsize'][0] * scale)
            fig, axes = _plt.subplots(1, 1, figsize=figsize)
        else:
            axes = ax

        deg = '$^{\circ}$'
        xticklabels = [str(int(y)) + deg for y in xticks]
        yticklabels = [str(int(y)) + deg for y in yticks]

        cim = axes.imshow(self.data, origin='upper',
                          extent=(0., 360., -90., 90.), **kwargs)
        axes.set(xticks=xticks, yticks=yticks)
        axes.set_xlabel(xlabel, fontsize=axes_labelsize)
        axes.set_ylabel(ylabel, fontsize=axes_labelsize)
        axes.set_xticklabels(xticklabels, fontsize=tick_labelsize)
        axes.set_yticklabels(yticklabels, fontsize=tick_labelsize)
        axes.set_xticks(minor_xticks, minor=True)
        axes.set_yticks(minor_yticks, minor=True)
        axes.grid(grid, which='major')

        if colorbar is True:
            if cb_orientation == 'vertical':
                divider = _make_axes_locatable(axes)
                cax = divider.append_axes("right", size="2.5%", pad=0.15)
                cbar = _plt.colorbar(cim, cax=cax, orientation=cb_orientation)
            else:
                divider = _make_axes_locatable(axes)
                cax = divider.append_axes("bottom", size="5%", pad=0.5)
                cbar = _plt.colorbar(cim, cax=cax,
                                     orientation=cb_orientation)
            if cb_label is not None:
                cbar.set_label(cb_label, fontsize=axes_labelsize)
            cbar.ax.tick_params(labelsize=tick_labelsize)

        if ax is None:
            return fig, axes
588887
def plot(self, x, y, **kw):
        
        return self.frame.plot(x,y,**kw)
356483
def write_cell(self, x, y, value):
        
        x += 1
        y += 1
        self._sheet.update_cell(x, y, value)
1263086
public Axis addLabel(String label, double location) {
        if (labels == null) {
            labels = new HashMap<>();
        }

        labels.put(label, location);
        setSlice();
        initGridLines();
        initGridLabels();
        return this;
    }
1363927
def setPoint(self, x, group, y):
        
        if x == -1:
            # silence window
            self.plot([0],[y], symbol='o')
        else:
            yindex = self.groups.index(group)
            xdata, ydata = self.lines[yindex].getData()
            if ydata is None:
                xdata = [x]
                ydata = [y]
            else:
                xdata = np.append(xdata, x)
                ydata = np.append(ydata, y)
            self.lines[yindex].setData(xdata, ydata)
1323514
def set_pointing_label(self):
        """"""

        current = self.current
        pointing = self.pointings[current]
        self.delete_pointing(None)
        pointing["label"]['text'] = self.plabel.get()
        self.pointings.append(pointing)
        self.plot_pointings([pointing])
        self.current = current
1298169
def _get_label(self, axis):
        """"""

        if axis == 'x':
            colname = self.x_col
        else:  # y
            colname = self.y_col

        if colname == self._idxname:
            label = 'Index'
        else:
            col = self.tab[colname]
            if col.unit:
                label = '{0} ({1})'.format(col.name, col.unit)
            else:
                label = col.name

        return label
689056
def add_tip_labels_to_axes(self):
        
        # get tip-coords and replace if using fixed_order
        if self.style.orient in ("up", "down"):
            ypos = np.zeros(self.ntips)
            xpos = np.arange(self.ntips)

        if self.style.orient in ("right", "left"):
            xpos = np.zeros(self.ntips)
            ypos = np.arange(self.ntips)

        # pop fill from color dict if using color
        if self.style.tip_labels_colors:
            self.style.tip_labels_style.pop("fill")

        # fill anchor shift if None 
        # (Toytrees fill this at draw() normally when tip_labels != None)
        if self.style.tip_labels_style["-toyplot-anchor-shift"] is None:
            self.style.tip_labels_style["-toyplot-anchor-shift"] = "15px"

        # add tip names to coordinates calculated above
        self.axes.text(
            xpos, 
            ypos,
            self.tip_labels,
            angle=(0 if self.style.orient in ("right", "left") else -90),
            style=self.style.tip_labels_style,
            color=self.style.tip_labels_colors,
        )
        # get stroke-width for aligned tip-label lines (optional)
        # copy stroke-width from the edge_style unless user set it
        if not self.style.edge_align_style.get("stroke-width"):
            self.style.edge_align_style['stroke-width'] = (
                self.style.edge_style['stroke-width'])
1063244
def oplot(self, x, y, **kw):
        
        return self.frame.oplot(x,y,**kw)