Draws a title on the graph.
768247
def draw_title
      return if (@hide_title || @title.nil?)

      @d.fill = @font_color
      @d.font = @title_font || @font if @title_font || @font
      @d.stroke('transparent')
      @d.pointsize = scale_fontsize(@title_font_size)
      @d.font_weight = if @bold_title then BoldWeight else NormalWeight end
      @d.gravity = NorthGravity
      @d = @d.annotate_scaled(@base_image,
                              @raw_columns, 1.0,
                              0, @top_margin,
                              @title, @scale)
    end
529370
protected void drawLabel (Graphics2D gfx, int x, int y)
    {
        _label.render(gfx, x + _lxoff, y + _lyoff);
    }
656258
def draw_summary(self, history, title=""):
        """"""
        # Generate summary string
        time_str = str(history.get_total_time()).split(".")[0]  # remove microseconds
        summary = "Step: {}      Time: {}".format(history.step, time_str)
        if title:
            summary = title + "\n\n" + summary
        self.figure.suptitle(summary)
158013
function drawTitles() {
            if (hasTitle()) {
                // either use title provided from the data
                // or customTitle provided via API method call
                if (legendGroup) {
                    legendGroup.remove();
                }

                legendGroup = svg.select('.metadata-group')
                  .append('g')
                    .classed('legend-group', true)
                    .attr('transform', `translate(0, ${chartHeight / 2})`);


                // override title with customTitle if given
                if (customTitle) {
                    title = customTitle;
                }

                titleEl = legendGroup.selectAll('text.bullet-title')
                  .data([1])
                  .enter()
                    .append('text')
                      .attr('class', 'bullet-title x-axis-label')
                      .text(title);

                // either use subtitle provided from the data
                // or customSubtitle provided via API method call
                if (subtitle || customSubtitle) {

                    // override subtitle with customSubtitle if given
                    if (customSubtitle) {
                        subtitle = customSubtitle;
                    }

                    titleEl = legendGroup.selectAll('text.bullet-subtitle')
                      .data([1])
                      .enter()
                        .append('text')
                          .attr('class', 'bullet-subtitle x-axis-label')
                          .attr('y', subtitleSpacing)
                          .text(subtitle);
                }
            }
        }
808694
def _make_title(self):
        """"""
        # Draw the game title.
        title = pygame.Surface((self.game_width, self.origin[1]), pygame.SRCALPHA)
        title.fill((0, 0, 0, 0))
        label = self.font.render(self.NAME, True, (119, 110, 101))
        title.blit(label, (self.BORDER, (90 - label.get_height()) / 2))
        # Draw the label for the objective.
        label = load_font(self.FONT_NAME, 18).render(
            'Join the numbers and get to the %d tile!' % self.WIN_TILE, True, (119, 110, 101))
        title.blit(label, (self.BORDER, self.origin[1] - label.get_height() - self.BORDER))

        # Draw the new game button and calculate its hitbox.
        x1, y1 = self.WIDTH - self.BORDER - 100, self.origin[1] - self.BORDER - 28
        w, h = 100, 30
        pygame.draw.rect(title, (238, 228, 218), (x1, y1, w, h))
        label = load_font(self.FONT_NAME, 18).render('New Game', True, (119, 110, 101))
        w1, h1 = label.get_size()
        title.blit(label, (x1 + (w - w1) / 2, y1 + (h - h1) / 2))

        # Return the title section and its hitbox.
        return title, (x1, y1, x1 + w, y1 + h)
729656
function drawGraph (opts) {

    // Clone the options, so the 'options' variable always keeps intact.
    var o = Flotr._.extend(Flotr._.clone(options), opts || {});

    // Return a new graph.
    return Flotr.draw(
      container,
      [ d1, d2, d3 ],
      o
    );
  }
985475
def draw
      # Maybe should be done in one of the following functions for more granularity.
      unless @has_data
        draw_no_data
        return
      end

      setup_data
      setup_drawing

      debug {
        # Outer margin
        @d.rectangle(@left_margin, @top_margin,
                     @raw_columns - @right_margin, @raw_rows - @bottom_margin)
        # Graph area box
        @d.rectangle(@graph_left, @graph_top, @graph_right, @graph_bottom)
      }

      draw_legend
      draw_line_markers
      draw_axis_labels
      draw_title
    end
1249316
def draw(self):
        
        obverse = slice(0, None)
        reverse = slice(None, None, -1)
        width = self.barwidth
        height = self.barheight
        nbars = len(self.bar)
        length = height
        direction = self.direction
        colors = self.bar['color'].tolist()
        labels = self.key['label'].tolist()
        themeable = self.theme.figure._themeable

        # When there is more than one guide, we keep
        # record of all of them using lists
        if 'legend_title' not in themeable:
            themeable['legend_title'] = []
        if 'legend_text_colorbar' not in themeable:
            themeable['legend_text_colorbar'] = []

        # .5 puts the ticks in the middle of the bars when
        # raster=False. So when raster=True the ticks are
        # in between interpolation points and the matching is
        # close though not exactly right.
        _from = self.bar['value'].min(), self.bar['value'].max()
        tick_locations = rescale(self.key['value'],
                                 (.5, nbars-.5),
                                 _from) * length/nbars

        if direction == 'horizontal':
            width, height = height, width
            length = width

        if self.reverse:
            colors = colors[::-1]
            labels = labels[::-1]
            tick_locations = length - tick_locations[::-1]

        # title #
        title_box = TextArea(self.title,
                             textprops=dict(color='black'))
        themeable['legend_title'].append(title_box)

        # colorbar and ticks #
        da = ColoredDrawingArea(width, height, 0, 0)
        if self.raster:
            add_interpolated_colorbar(da, colors, direction)
        else:
            add_segmented_colorbar(da, colors, direction)

        if self.ticks:
            _locations = tick_locations
            if not self.draw_ulim:
                _locations = _locations[:-1]

            if not self.draw_llim:
                _locations = _locations[1:]

            add_ticks(da, _locations, direction)

        # labels #
        if self.label:
            labels_da, legend_text = create_labels(da, labels,
                                                   tick_locations,
                                                   direction)
            themeable['legend_text_colorbar'].extend(legend_text)
        else:
            labels_da = ColoredDrawingArea(0, 0)

        # colorbar + labels #
        if direction == 'vertical':
            packer, align = HPacker, 'bottom'
            align = 'center'
        else:
            packer, align = VPacker, 'right'
            align = 'center'
        slc = obverse if self.label_position == 'right' else reverse
        if self.label_position in ('right', 'bottom'):
            slc = obverse
        else:
            slc = reverse
        main_box = packer(children=[da, labels_da][slc],
                          sep=self._label_margin,
                          align=align,
                          pad=0)

        # title + colorbar(with labels) #
        lookup = {
            'right': (HPacker, reverse),
            'left': (HPacker, obverse),
            'bottom': (VPacker, reverse),
            'top': (VPacker, obverse)}
        packer, slc = lookup[self.title_position]
        children = [title_box, main_box][slc]
        box = packer(children=children,
                     sep=self._title_margin,
                     align=self._title_align,
                     pad=0)
        return box
970591
private void drawYValues(Graphics2D chartGraphics) {
    if (!showYAxisValues) {
      return;
    }

    chartGraphics.setColor(axisValuesColour);

    for (int i = 0; i < yValues.length; i++) {
      if (i % yAxisValuesFrequency != 0) {
        continue;
      }

      String yValueStr = yValues[i].toString();

      chartGraphics.setFont(axisValuesFont);
      FontMetrics metrics = chartGraphics.getFontMetrics();

      int valueWidth = metrics.stringWidth(yValueStr);

      if (yValuesHorizontal) {
        // Draw the value with whatever font is now set.
        int valueXPos = margin + yAxisLabelSize.height + (yAxisValuesWidthMax - valueWidth);
        int valueYPos = heatMapTL.y + (i * cellSize.height) + (cellSize.height / 2)
            + (yAxisValuesAscent / 2);

        chartGraphics.drawString(yValueStr, valueXPos, valueYPos);
      }
      else {
        int valueXPos = margin + yAxisLabelSize.height + yAxisValuesAscent;
        int valueYPos = heatMapTL.y + (i * cellSize.height) + (cellSize.height / 2)
            + (valueWidth / 2);

        // Create 270 degree rotated transform.
        AffineTransform transform = chartGraphics.getTransform();
        AffineTransform originalTransform = (AffineTransform) transform.clone();
        transform.rotate(Math.toRadians(270), valueXPos, valueYPos);
        chartGraphics.setTransform(transform);

        // Draw the string.
        chartGraphics.drawString(yValueStr, valueXPos, valueYPos);

        // Revert to original transform before rotation.
        chartGraphics.setTransform(originalTransform);
      }
    }
  }
609676
public void drawText(Graphics2D g) {
		// We don't want to corrupt the graphics environs with our
		// affine transforms!
		Graphics2D g2 = (Graphics2D) g.create();
		g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		g2.transform(affineToText);

		// What about the text label?
		FontMetrics metrics = g2.getFontMetrics();
		bounds = metrics.getStringBounds(getLabel(), g2);
		// Will the label appear to be upside down?
		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());
		for (int i = 0; i < label.length(); i += CHARS_PER_STEP) {
			String sublabel = label.substring(i, Math.min(i + CHARS_PER_STEP,
					label.length()));
			g2.drawString(sublabel, -dx, dy);
			dx -= metrics.getStringBounds(sublabel, g2).getWidth();
		}
		// g2.drawString(label, -dx, dy);
		g2.dispose();
		/*
		 * if (GRAPHICS == null) { GRAPHICS = g.create(); METRICS =
		 * GRAPHICS.getFontMetrics(); }
		 */
	}
1365348
def draw(self, **kwargs):
        
        if self.orientation_ == 'h':
            # Make the plot
            self.ax.barh(np.arange(len(self.ranks_)), self.ranks_, color='b')

            # Add ticks and tick labels
            self.ax.set_yticks(np.arange(len(self.ranks_)))
            if self.show_feature_names_:
                self.ax.set_yticklabels(self.features_)
            else:
                self.ax.set_yticklabels([])

            # Order the features from top to bottom on the y axis
            self.ax.invert_yaxis()

            # Turn off y grid lines
            self.ax.yaxis.grid(False)

        elif self.orientation_ == 'v':
            # Make the plot
            self.ax.bar(np.arange(len(self.ranks_)), self.ranks_, color='b')

            # Add ticks and tick labels
            self.ax.set_xticks(np.arange(len(self.ranks_)))
            if self.show_feature_names_:
                self.ax.set_xticklabels(self.features_, rotation=90)
            else:
                self.ax.set_xticklabels([])

            # Turn off x grid lines
            self.ax.xaxis.grid(False)

        else:
            raise YellowbrickValueError(
                "Orientation must be 'h' or 'v'"
            )
855743
def title(self, title, show=False):
        """"""
        self._write("title:%d:%s\n" % (int(show), title))
        return self
761011
def _draw(self, tree, indent=0):
        """"""
        if all([
            isinstance(tree, dict),
            type(tree) != BarDescriptor
        ]):
            for k, v in sorted(tree.items()):
                bar_desc, subdict = v[0], v[1]

                args = [self.cursor.term] + bar_desc.get("args", [])
                kwargs = dict(title_pos="above", indent=indent, title=k)
                kwargs.update(bar_desc.get("kwargs", {}))

                b = Bar(*args, **kwargs)
                b.draw(value=bar_desc["value"].value, flush=False)

                self._draw(subdict, indent=indent + self.indent)
430420
def draw_axis_labels
      unless @x_axis_label.nil?
        # X Axis
        # Centered vertically and horizontally by setting the
        # height to 1.0 and the width to the width of the graph.
        x_axis_label_y_coordinate = @graph_bottom + LABEL_MARGIN * 2 + @marker_caps_height

        # TODO Center between graph area
        @d.fill = @font_color
        @d.font = @font if @font
        @d.stroke('transparent')
        @d.pointsize = scale_fontsize(@marker_font_size)
        @d.gravity = NorthGravity
        @d = @d.annotate_scaled(@base_image,
                                @raw_columns, 1.0,
                                0.0, x_axis_label_y_coordinate,
                                @x_axis_label, @scale)
        debug { @d.line 0.0, x_axis_label_y_coordinate, @raw_columns, x_axis_label_y_coordinate }
      end

      unless @y_axis_label.nil?
        # Y Axis, rotated vertically
        @d.rotation = -90.0
        @d.gravity = CenterGravity
        @d = @d.annotate_scaled(@base_image,
                                1.0, @raw_rows,
                                @left_margin + @marker_caps_height / 2.0, 0.0,
                                @y_axis_label, @scale)
        @d.rotation = 90.0
      end
    end
1359294
def _draw_labels(self):
        
        # This is very laboured. Should be changed when MPL
        # finally has a constraint based layout manager.
        figure = self.figure
        get_property = self.theme.themeables.property

        try:
            margin = get_property('axis_title_x', 'margin')
        except KeyError:
            pad_x = 5
        else:
            pad_x = margin.get_as('t', 'pt')

        try:
            margin = get_property('axis_title_y', 'margin')
        except KeyError:
            pad_y = 5
        else:
            pad_y = margin.get_as('r', 'pt')

        # Get the axis labels (default or specified by user)
        # and let the coordinate modify them e.g. flip
        labels = self.coordinates.labels({
            'x': self.layout.xlabel(self.labels),
            'y': self.layout.ylabel(self.labels)
        })

        # The first axes object is on left, and the last axes object
        # is at the bottom. We change the transform so that the relevant
        # coordinate is in figure coordinates. This way we take
        # advantage of how MPL adjusts the label position so that they
        # do not overlap with the tick text. This works well for
        # facetting with scales='fixed' and also when not facetting.
        # first_ax = self.axs[0]
        # last_ax = self.axs[-1]

        xlabel = self.facet.last_ax.set_xlabel(
            labels['x'], labelpad=pad_x)
        ylabel = self.facet.first_ax.set_ylabel(
            labels['y'], labelpad=pad_y)

        xlabel.set_transform(mtransforms.blended_transform_factory(
            figure.transFigure, mtransforms.IdentityTransform()))
        ylabel.set_transform(mtransforms.blended_transform_factory(
            mtransforms.IdentityTransform(), figure.transFigure))

        figure._themeable['axis_title_x'] = xlabel
        figure._themeable['axis_title_y'] = ylabel
910915
private function drawYaxis()
    {

        $min =
            round($this->min, $this->precision);
        $max =
            round($this->max, $this->precision);

        if (!isset($this->y_axis_legend_increment)) {

            $increment =
                round(($max - $min) / $this->total_values, $this->precision);
        } else {
            $increment = $this->y_axis_legend_increment;
        }

        if ($increment == 0) {
            $increment = 1;
        }

        //$spacing = \round($spacing, 10);
        for ($label = $min; $label <= $max + $increment; $label+=$increment) {

            $px_position = $this->plotValue($label);
            if ($this->x_axis_hints == 1) {
                \imageline($this->im, 0, $px_position, $this->width,
                    $px_position, $this->ink['axis']);
            }
            imagestring($this->im, 1, 10, $px_position - 4, $label,
                $this->ink['text']);
        }
    }
57899
def show(self, ax:plt.Axes, **kwargs):
        ""
        ax.set_title(str(self))