Draws connected dots.

    Parameters
    ----------
    x : array-like, optional
    y : array-like, optional
    label : array-like, optional

    Returns
    -------
    Chart
197814
def line(
    x=None,
    y=None,
    label=None,
    color=None,
    width=None,
    dash=None,
    opacity=None,
    mode='lines+markers',
    yaxis=1,
    fill=None,
    text="",
    markersize=6,
):
    
    assert x is not None or y is not None, "x or y must be something"
    yn = 'y' + str(yaxis)
    lineattr = {}
    if color:
        lineattr['color'] = color
    if width:
        lineattr['width'] = width
    if dash:
        lineattr['dash'] = dash
    if y is None:
        y = x
        x = None
    if x is None:
        x = np.arange(len(y))
    else:
        x = _try_pydatetime(x)
    x = np.atleast_1d(x)
    y = np.atleast_1d(y)
    assert x.shape[0] == y.shape[0]
    if y.ndim == 2:
        if not hasattr(label, '__iter__'):
            if label is None:
                label = _labels()
            else:
                label = _labels(label)
        data = [
            go.Scatter(
                x=x,
                y=yy,
                name=ll,
                line=lineattr,
                mode=mode,
                text=text,
                fill=fill,
                opacity=opacity,
                yaxis=yn,
                marker=dict(size=markersize, opacity=opacity),
            )
            for ll, yy in zip(label, y.T)
        ]
    else:
        data = [
            go.Scatter(
                x=x,
                y=y,
                name=label,
                line=lineattr,
                mode=mode,
                text=text,
                fill=fill,
                opacity=opacity,
                yaxis=yn,
                marker=dict(size=markersize, opacity=opacity),
            )
        ]
    if yaxis == 1:
        return Chart(data=data)

    return Chart(data=data, layout={'yaxis' + str(yaxis): dict(overlaying='y')})
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
1323291
def draw(x,y,image)
      obj = self.dup()
      obj.draw!(x,y,image)
      obj
    end
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']);
        }
    }
130628
def plot_many(self, datalist, side='left', title=None,
                  xlabel=None, ylabel=None, **kws):
        
        def unpack_tracedata(tdat, **kws):
            if (isinstance(tdat, dict) and
                'xdata' in tdat and 'ydata' in tdat):
                xdata = tdat.pop('xdata')
                ydata = tdat.pop('ydata')
                out = kws
                out.update(tdat)
            elif isinstance(tdat, (list, tuple)):
                out = kws
                xdata = tdat[0]
                ydata = tdat[1]
            return (xdata, ydata, out)

        opts = dict(side=side, title=title, xlabel=xlabel, ylabel=ylabel,
                    delay_draw=True)
        opts.update(kws)
        x0, y0, opts = unpack_tracedata(datalist[0], **opts)

        self.plot(x0, y0, **opts)

        for dat in datalist[1:]:
            x, y, opts = unpack_tracedata(dat, delay_draw=True)
            self.oplot(x, y, **opts)

        conf = self.conf
        if conf.show_legend:
            conf.draw_legend()
        conf.relabel()
        self.draw()
        self.canvas.Refresh()
243471
def plotPixel(self, x, y, color="black"):
        
        p = Point(x, y)
        p.fill(color)
        p.draw(self)
        p.t = lambda v: v
        p.tx = lambda v: v
        p.ty = lambda v: v
61774
def _draw(self):
        """"""
        self._compute()
        self._compute_x_labels()
        self._compute_x_labels_major()
        self._compute_y_labels()
        self._compute_y_labels_major()
        self._compute_secondary()
        self._post_compute()
        self._compute_margin()
        self._decorate()
        if self.series and self._has_data() and self._values:
            self._plot()
        else:
            self.svg.draw_no_data()
1157445
function (index, xy) {
            var show = true,
              axis = this.axis,
              isFirst = this.isFirst,
              isLast = this.isLast,
              horiz = axis.horiz,
              pxPos = horiz ? xy.x : xy.y,
              reversed = axis.reversed,
              tickPositions = axis.tickPositions,
              sides = this.getLabelSides(),
              leftSide = sides[0],
              rightSide = sides[1],
              axisLeft,
              axisRight,
              neighbour,
              neighbourEdge,
              line = this.label.line,
              lineIndex = line || 0,
              labelEdge = axis.labelEdge,
              justifyLabel = axis.justifyLabels && (isFirst || isLast),
              justifyToPlot;

            // Hide it if it now overlaps the neighbour label
            if (labelEdge[lineIndex] === UNDEFINED || pxPos + leftSide > labelEdge[lineIndex]) {
                labelEdge[lineIndex] = pxPos + rightSide;

            } else if (!justifyLabel) {
                show = false;
            }

            if (justifyLabel) {
                justifyToPlot = axis.justifyToPlot;
                axisLeft = justifyToPlot ? axis.pos : 0;
                axisRight = justifyToPlot ? axisLeft + axis.len : axis.chart.chartWidth;

                // Find the firsth neighbour on the same line
                do {
                    index += (isFirst ? 1 : -1);
                    neighbour = axis.ticks[tickPositions[index]];
                } while (tickPositions[index] && (!neighbour || !neighbour.label || neighbour.label.line !== line)); // #3044

                neighbourEdge = neighbour && neighbour.label.xy && neighbour.label.xy.x + neighbour.getLabelSides()[isFirst ? 0 : 1];

                if ((isFirst && !reversed) || (isLast && reversed)) {
                    // Is the label spilling out to the left of the plot area?
                    if (pxPos + leftSide < axisLeft) {

                        // Align it to plot left
                        pxPos = axisLeft - leftSide;

                        // Hide it if it now overlaps the neighbour label
                        if (neighbour && pxPos + rightSide > neighbourEdge) {
                            show = false;
                        }
                    }

                } else {
                    // Is the label spilling out to the right of the plot area?
                    if (pxPos + rightSide > axisRight) {

                        // Align it to plot right
                        pxPos = axisRight - rightSide;

                        // Hide it if it now overlaps the neighbour label
                        if (neighbour && pxPos + leftSide < neighbourEdge) {
                            show = false;
                        }

                    }
                }

                // Set the modified x position of the label
                xy.x = pxPos;
            }
            return show;
        }
103061
function drawDataReferencePoints() {
            // Creates Dots on Data points
            var points = svg.select('.chart-group').selectAll('.dots')
                .data(layers)
                .enter()
                  .append('g')
                    .attr('class', 'dots')
                    .attr('d', ({values}) => area(values))
                    .attr('clip-path', 'url(#clip)');

            // Processes the points
            // TODO: Optimize this code
            points.selectAll('.dot')
                .data(({values}, index) => values.map((point) => ({index, point})))
                .enter()
                  .append('circle')
                    .attr('class','dot')
                    .attr('r', () => pointsSize)
                    .attr('fill', () => pointsColor)
                    .attr('stroke-width', '0')
                    .attr('stroke', pointsBorderColor)
                    .attr('transform', function(d) {
                        let {point} = d;
                        let key = xScale(point.date);

                        dataPoints[key] = dataPoints[key] || [];
                        dataPoints[key].push(d);

                        let {date, y, y0} = point;

                        return `translate( ${xScale(date)}, ${yScale(y + y0)} )`;
                    });
        }
1300945
def draw_value_label(x_offset, y_offset, data_point, bar_value=false)
      return if @hide_line_markers && !bar_value

      #y_offset = @graph_bottom + LABEL_MARGIN

      @d.fill = @font_color
      @d.font = @font if @font
      @d.stroke('transparent')
      @d.font_weight = NormalWeight
      @d.pointsize = scale_fontsize(@marker_font_size)
      @d.gravity = NorthGravity
      @d = @d.annotate_scaled(@base_image,
                              1.0, 1.0,
                              x_offset, y_offset,
                              data_point.to_s, @scale)

      debug { @d.line 0.0, y_offset, @raw_columns, y_offset }
    end
1225007
function drawAxisLabels() {
            if (yAxisLabel) {
                if (yAxisLabelEl) {
                    yAxisLabelEl.remove();
                }
                yAxisLabelEl = svg.select('.y-axis-label')
                  .append('text')
                    .classed('y-axis-label-text', true)
                    .attr('x', -chartHeight / 2)
                    .attr('y', yAxisLabelOffset)
                    .attr('text-anchor', 'middle')
                    .attr('transform', 'rotate(270 0 0)')
                    .text(yAxisLabel);
            }

            if (xAxisLabel) {
                if (xAxisLabelEl) {
                    xAxisLabelEl.remove();
                }
                xAxisLabelEl = svg.select('.x-axis-label')
                  .append('text')
                    .attr('y', xAxisLabelOffset)
                    .attr('text-anchor', 'middle')
                    .classed('x-axis-label-text', true)
                    .attr('x', chartWidth / 2)
                    .text(xAxisLabel);
            }
        }
908919
def draw(self, points, target=None, **kwargs):
        

        # Resolve the labels with the classes
        labels = self.labels if self.labels is not None else self.classes_
        if len(labels) != len(self.classes_):
            raise YellowbrickValueError((
                "number of supplied labels ({}) does not "
                "match the number of classes ({})"
            ).format(len(labels), len(self.classes_)))

        # Create the color mapping for the labels.
        color_values = resolve_colors(
            n_colors=len(labels), colormap=self.colormap, colors=self.color)
        colors = dict(zip(labels, color_values))

        # Transform labels into a map of class to label
        labels = dict(zip(self.classes_, labels))

        # Define boundaries with a vertical line
        if self.annotate_docs:
            for xcoords in self.boundaries_:
                self.ax.axvline(x=xcoords, color='lightgray', linestyle='dashed')

        series = defaultdict(lambda: {'x':[], 'y':[]})

        if target is not None:
            for point, t in zip(points, target):
                label = labels[t]
                series[label]['x'].append(point[0])
                series[label]['y'].append(point[1])
        else:
            label = self.classes_[0]
            for x, y in points:
                series[label]['x'].append(x)
                series[label]['y'].append(y)

        for label, points in series.items():
            self.ax.scatter(points['x'], points['y'], marker='|',
                            c=colors[label], zorder=100, label=label)

        self.ax.set_yticks(list(range(len(self.indexed_words_))))
        self.ax.set_yticklabels(self.indexed_words_)
1149676
def plot_row_coordinates(self, X, ax=None, figsize=(6, 6), x_component=0, y_component=1,
                             labels=None, color_labels=None, ellipse_outline=False,
                             ellipse_fill=True, show_points=True, **kwargs):
        """"""
        utils.validation.check_is_fitted(self, 's_')

        if ax is None:
            fig, ax = plt.subplots(figsize=figsize)

        # Add style
        ax = plot.stylize_axis(ax)

        # Make sure X is a DataFrame
        if not isinstance(X, pd.DataFrame):
            X = pd.DataFrame(X)

        # Retrieve principal coordinates
        coordinates = self.row_coordinates(X)
        x = coordinates[x_component].astype(np.float)
        y = coordinates[y_component].astype(np.float)

        # Plot
        if color_labels is None:
            ax.scatter(x, y, **kwargs)
        else:
            for color_label in sorted(list(set(color_labels))):
                mask = np.array(color_labels) == color_label
                color = ax._get_lines.get_next_color()
                # Plot points
                if show_points:
                    ax.scatter(x[mask], y[mask], color=color, **kwargs, label=color_label)
                # Plot ellipse
                if (ellipse_outline or ellipse_fill):
                    x_mean, y_mean, width, height, angle = plot.build_ellipse(x[mask], y[mask])
                    ax.add_patch(mpl.patches.Ellipse(
                        (x_mean, y_mean),
                        width,
                        height,
                        angle=angle,
                        linewidth=2 if ellipse_outline else 0,
                        color=color,
                        fill=ellipse_fill,
                        alpha=0.2 + (0.3 if not show_points else 0) if ellipse_fill else 1
                    ))

        # Add labels
        if labels is not None:
            for i, label in enumerate(labels):
                ax.annotate(label, (x[i], y[i]))

        # Legend
        ax.legend()

        # Text
        ax.set_title('Row principal coordinates')
        ei = self.explained_inertia_
        ax.set_xlabel('Component {} ({:.2f}% inertia)'.format(x_component, 100 * ei[x_component]))
        ax.set_ylabel('Component {} ({:.2f}% inertia)'.format(y_component, 100 * ei[y_component]))

        return ax
523989
def draw_icon(point, icon)
      x, y = point.pixel(@bounding_box)
      icon.draw(@canvas, x, y)
    end
839410
def draw(self):
        
        # Compute the sizes of the markers from their score
        sizes = self._get_cluster_sizes()

        # Draw the scatter plots with associated sizes on the graph
        self.ax.scatter(
            self.embedded_centers_[:,0], self.embedded_centers_[:,1],
            s=sizes, c=self.facecolor, edgecolor=self.edgecolor, linewidth=1,
        )

        # Annotate the clusters with their labels
        for i, pt in enumerate(self.embedded_centers_):
            self.ax.text(
                s=str(i), x=pt[0], y=pt[1], va="center", ha="center", fontweight="bold"
            )

        # Ensure the current axes is always the main residuals axes
        plt.sca(self.ax)
        return self.ax
1284944
def draw_axes(self):
        
        self.canvas.delete('all')
        rect = 50, 50, self.w - 50, self.h - 50

        self.canvas.create_rectangle(rect, outline="black")

        for x in self.frange(0, self.x_max - self.x_min + 1, self.x_tick):
            value = Decimal(self.x_min + x)
            if self.x_min <= value <= self.x_max:
                x_step = (self.px_x * x) / self.x_tick
                coord = 50 + x_step, self.h - 50, 50 + x_step, self.h - 45
                self.canvas.create_line(coord, fill="black")
                coord = 50 + x_step, self.h - 40

                label = round(Decimal(self.x_min + x), 1)
                self.canvas.create_text(coord, fill="black", text=label)

        for y in self.frange(0, self.y_max - self.y_min + 1, self.y_tick):
            value = Decimal(self.y_max - y)

            if self.y_min <= value <= self.y_max:
                y_step = (self.px_y * y) / self.y_tick
                coord = 45, 50 + y_step, 50, 50 + y_step
                self.canvas.create_line(coord, fill="black")
                coord = 35, 50 + y_step

                label = round(value, 1)
                self.canvas.create_text(coord, fill="black", text=label)
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'"
            )