/*
Draws the y-values onto the y-axis if showYAxisValues is set to true.
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);
      }
    }
  }
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
213711
function drawTick(y) {
    barGroup.appendChild(
      svgElement(
        legend,
        "line",
        {
          x1: legend.itemWidth,
          x2: legend.itemWidth + 5,
          y1: y,
          y2: y
        },
        "tick-mark"
      )
    );
  }
1177081
function drawDataPointsValueHighlights(data) {
            showCrossHairComponentsWithLabels(true);

            // Draw line perpendicular to y-axis
            highlightCrossHairContainer.selectAll('line.highlight-y-line')
              .attr('stroke', nameColorMap[data.name])
              .attr('class', 'highlight-y-line')
              .attr('x1', (xScale(data.x) - areaScale(data.y)))
              .attr('x2', 0)
              .attr('y1', yScale(data.y))
              .attr('y2', yScale(data.y));


            // Draw line perpendicular to x-axis
            highlightCrossHairContainer.selectAll('line.highlight-x-line')
              .attr('stroke', nameColorMap[data.name])
              .attr('class', 'highlight-x-line')
              .attr('x1', xScale(data.x))
              .attr('x2', xScale(data.x))
              .attr('y1', (yScale(data.y) + areaScale(data.y)))
              .attr('y2', chartHeight);

            // Draw data label for y value
            highlightCrossHairLabelsContainer.selectAll('text.highlight-y-legend')
              .attr('text-anchor', 'middle')
              .attr('fill', nameColorMap[data.name])
              .attr('class', 'highlight-y-legend')
              .attr('y', (yScale(data.y) + (areaScale(data.y) / 2)))
              .attr('x', highlightTextLegendOffset)
              .text(`${d3Format.format(yAxisFormat)(data.y)}`);

            // Draw data label for x value
            highlightCrossHairLabelsContainer.selectAll('text.highlight-x-legend')
              .attr('text-anchor', 'middle')
              .attr('fill', nameColorMap[data.name])
              .attr('class', 'highlight-x-legend')
              .attr('transform', `translate(0, ${chartHeight - highlightTextLegendOffset})`)
              .attr('x', (xScale(data.x) - (areaScale(data.y) / 2)))
              .text(`${d3Format.format(xAxisFormat)(data.x)}`);
        }
944101
function drawAxisLabels() {
            // If y-axis label is given, draw it
            if (yAxisLabel) {
                if (yAxisLabelEl) {
                    svg.selectAll('.y-axis-label-text').remove();
                }

                yAxisLabelEl = svg.select('.axis-labels-group')
                    .append('g')
                    .attr('class', 'y-axis-label')
                      .append('text')
                      .classed('y-axis-label-text', true)
                      .attr('x', -chartHeight / 2)
                      .attr('y', yAxisLabelOffset - xAxisPadding.left)
                      .attr('text-anchor', 'middle')
                      .attr('transform', 'rotate(270 0 0)')
                      .text(yAxisLabel)
            }

            // If x-axis label is given, draw it
            if (xAxisLabel) {
                if (xAxisLabelEl) {
                    svg.selectAll('.x-axis-label-text').remove();
                }

                xAxisLabelEl = svg.selectAll('.axis-labels-group')
                    .append('g')
                    .attr('class', 'x-axis-label')
                      .append('text')
                      .classed('x-axis-label-text', true)
                      .attr('x', chartWidth / 2)
                      .attr('y', chartHeight - xAxisLabelOffset)
                      .attr('text-anchor', 'middle')
                      .text(xAxisLabel);
            }
        }
47457
protected void paintTick(Graphics g, ValueDimension dim, Number tickValue, int tickLength) {
		String str = String.format(getTickInfo(dim).getFormat(), tickValue.doubleValue());
		int xPosition;
		int yPosition;
		Point descPos;
		switch (dim) {
		case X:
			xPosition = getXFor(tickValue);
			yPosition = getPaintingRegion().getBottomLeft().y;
			g.drawLine(xPosition, yPosition, xPosition, yPosition+tickLength);
			descPos = getPaintingRegion().getDescriptionPos(dim, str, xPosition);
			g.drawString(str, descPos.x, descPos.y+tickLength);
			break;
		case Y:
			xPosition = getPaintingRegion().getBottomLeft().x;
			yPosition = getYFor(tickValue);
			g.drawLine(xPosition, yPosition, xPosition-tickLength, yPosition);
			descPos = getPaintingRegion().getDescriptionPos(dim, str, yPosition);
			g.drawString(str, descPos.x-tickLength, descPos.y+tickLength);
			break;
		}
	}
884648
function drawLinearTick(context, x1, y1, x2, y2) {
    context.beginPath();

    context.moveTo(x1, y1);
    context.lineTo(x2, y2);
    context.stroke();

    context.closePath();
    context.save();
}
1282554
def draw_plot(self, metrics, labels=None, ylabel=""):
        
        metrics = metrics if isinstance(metrics, list) else [metrics]
        # Loop through metrics
        title = ""
        for i, m in enumerate(metrics):
            label = labels[i] if labels else m.name
            # TODO: use a standard formating function for values
            title += ("   " if title else "") + "{}: {}".format(label, m.data[-1])
            self.ax.plot(m.formatted_steps, m.data, label=label)
        self.ax.set_title(title)
        self.ax.set_ylabel(ylabel)
        self.ax.legend()
        self.ax.set_xlabel("Steps")
        self.ax.xaxis.set_major_locator(plt.AutoLocator())
1238018
function(x, y){
            var coords = this.renderer.mouseToTileCoords(x, y),
                tile = this.map.get(coords.x, coords.y);
            if(tile){
                this.renderer.hoveredTileX = tile.x;
                this.renderer.hoveredTileY = tile.y;
            } else {
                this.renderer.hoveredTileX = null;
                this.renderer.hoveredTileY = null;
            }
            this.renderer.draw();
        }
494565
function (index, xy) {
		var show = true,
			axis = this.axis,
			chart = axis.chart,
			isFirst = this.isFirst,
			isLast = this.isLast,
			x = xy.x,
			reversed = axis.reversed,
			tickPositions = axis.tickPositions;

		if (isFirst || isLast) {

			var sides = this.getLabelSides(),
				leftSide = sides[0],
				rightSide = sides[1],
				plotLeft = chart.plotLeft,
				plotRight = plotLeft + axis.len,
				neighbour = axis.ticks[tickPositions[index + (isFirst ? 1 : -1)]],
				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 (x + leftSide < plotLeft) {

					// Align it to plot left
					x = plotLeft - leftSide;

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

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

					// Align it to plot right
					x = plotRight - rightSide;

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

				}
			}

			// Set the modified x position of the label
			xy.x = x;
		}
		return show;
	}
513236
protected void drawBars(Canvas _Canvas) {

        RectF  bounds;
        String valueString;
        float  animatedRightOffset;

        for (BarModel model : mData) {
            bounds              = model.getBarBounds();
            valueString         = Utils.getFloatString(model.getValue(), mShowDecimal) + mValueUnit;
            animatedRightOffset = bounds.right * mRevealValue;

            mGraphPaint.setColor(model.getColor());

            _Canvas.drawRect(
                    bounds.left,
                    bounds.top,
                    bounds.right * mRevealValue,
                    bounds.bottom, mGraphPaint);

            if (mShowValues && animatedRightOffset > mValuePaint.measureText(valueString)) {
                mValuePaint.setColor(mLegendColor);
                _Canvas.drawText(
                        valueString,
                        bounds.left + mValueDistance,
                        bounds.centerY() + (mMaxFontHeight / 2),
                        mValuePaint
                );
            }

            if (mShowBarLabel) {
                mValuePaint.setColor(mBarLabelColor);
                _Canvas.drawText(
                        model.getLegendLabel(),
                        animatedRightOffset + mValueDistance,
                        bounds.centerY() + (mMaxFontHeight / 2),
                        mValuePaint
                );
            }
        }
    }
261661
function draw(){
    
    ctx.clearRect(0,0,WIDTH,HEIGHT);
    
    var netx = new convnetjs.Vol(1,1,2);
    // draw decisions in the grid
    var density= 5.0;
    var gridstep = 2;
    var gridx = [];
    var gridy = [];
    var gridl = []; 
    for(var x=0.0, cx=0; x<=WIDTH; x+= density, cx++) {
      for(var y=0.0, cy=0; y<=HEIGHT; y+= density, cy++) {
        //var dec= svm.marginOne([(x-WIDTH/2)/ss, (y-HEIGHT/2)/ss]);
        netx.w[0] = (x-WIDTH/2)/ss;
        netx.w[1] = (y-HEIGHT/2)/ss;
        var a = net.forward(netx, false);
        
        if(a.w[0] > a.w[1]) ctx.fillStyle = 'rgb(250, 150, 150)';
        else ctx.fillStyle = 'rgb(150, 250, 150)';

        //ctx.fillStyle = 'rgb(150,' + Math.floor(a.w[0]*105)+150 + ',150)';
        //ctx.fillStyle = 'rgb(' + Math.floor(a.w[0]*255) + ',' + Math.floor(a.w[1]*255) + ', 0)';
        ctx.fillRect(x-density/2-1, y-density/2-1, density+2, density+2);

        if(cx%gridstep === 0 && cy%gridstep===0) {
          // record the transformation information
          var xt = net.layers[lix].out_act.w[d0]; // in screen coords
          var yt = net.layers[lix].out_act.w[d1]; // in screen coords
          gridx.push(xt);
          gridy.push(yt);
          gridl.push(a.w[0] > a.w[1]); // remember final label as well
        }
      }
    }

    // draw axes
    ctx.beginPath();
    ctx.strokeStyle = 'rgb(50,50,50)';
    ctx.lineWidth = 1;
    ctx.moveTo(0, HEIGHT/2);
    ctx.lineTo(WIDTH, HEIGHT/2);
    ctx.moveTo(WIDTH/2, 0);
    ctx.lineTo(WIDTH/2, HEIGHT);
    ctx.stroke();

    // draw representation transformation axes for two neurons at some layer
    var mmx = cnnutil.maxmin(gridx);
    var mmy = cnnutil.maxmin(gridy);
    visctx.clearRect(0,0,visWIDTH,visHEIGHT);
    visctx.strokeStyle = 'rgb(0, 0, 0)';
    var n = Math.floor(Math.sqrt(gridx.length)); // size of grid. Should be fine?
    var ng = gridx.length;
    var c = 0; // counter
    visctx.beginPath() 
    for(var x=0;x<n;x++) {
      for(var y=0;y<n;y++) {

        // down
        var ix1 = x*n+y;
        var ix2 = x*n+y+1;
        if(ix1 >= 0 && ix2 >= 0 && ix1 < ng && ix2 < ng && y<n-1) { // check oob
          var xraw = gridx[ix1];
          xraw1 = visWIDTH*(gridx[ix1] - mmx.minv)/mmx.dv;
          yraw1 = visHEIGHT*(gridy[ix1] - mmy.minv)/mmy.dv;
          xraw2 = visWIDTH*(gridx[ix2] - mmx.minv)/mmx.dv;
          yraw2 = visHEIGHT*(gridy[ix2] - mmy.minv)/mmy.dv;
          visctx.moveTo(xraw1, yraw1);
          visctx.lineTo(xraw2, yraw2);
        }

        // and draw its color
        if(gridl[ix1]) visctx.fillStyle = 'rgb(250, 150, 150)';
        else visctx.fillStyle = 'rgb(150, 250, 150)';
        var sz = density * gridstep;
        visctx.fillRect(xraw1-sz/2-1, yraw1-sz/2-1, sz+2, sz+2);

        // right
        var ix1 = (x+1)*n+y;
        var ix2 = x*n+y;
        if(ix1 >= 0 && ix2 >= 0 && ix1 < ng && ix2 < ng && x <n-1) { // check oob
          var xraw = gridx[ix1];
          xraw1 = visWIDTH*(gridx[ix1] - mmx.minv)/mmx.dv;
          yraw1 = visHEIGHT*(gridy[ix1] - mmy.minv)/mmy.dv;
          xraw2 = visWIDTH*(gridx[ix2] - mmx.minv)/mmx.dv;
          yraw2 = visHEIGHT*(gridy[ix2] - mmy.minv)/mmy.dv;
          visctx.moveTo(xraw1, yraw1);
          visctx.lineTo(xraw2, yraw2);
        }
 
      }
    }
    visctx.stroke();

    // draw datapoints.
    ctx.strokeStyle = 'rgb(0,0,0)';
    ctx.lineWidth = 1;
    for(var i=0;i<N;i++) {
      
      if(labels[i]==1) ctx.fillStyle = 'rgb(100,200,100)';
      else ctx.fillStyle = 'rgb(200,100,100)';
      
      drawCircle(data[i][0]*ss+WIDTH/2, data[i][1]*ss+HEIGHT/2, 5.0);

      // also draw transformed data points while we're at it
      netx.w[0] = data[i][0];
      netx.w[1] = data[i][1]
      var a = net.forward(netx, false);
      var xt = visWIDTH * (net.layers[lix].out_act.w[d0] - mmx.minv) / mmx.dv; // in screen coords
      var yt = visHEIGHT * (net.layers[lix].out_act.w[d1] - mmy.minv) / mmy.dv; // in screen coords
      if(labels[i]==1) visctx.fillStyle = 'rgb(100,200,100)';
      else visctx.fillStyle = 'rgb(200,100,100)';
      visctx.beginPath();
      visctx.arc(xt, yt, 5.0, 0, Math.PI*2, true); 
      visctx.closePath();
      visctx.stroke();
      visctx.fill();
    }
}
453274
private void drawEventsWithPlus(Canvas canvas, float xPosition, float yPosition, List<Event> eventsList) {
        // k = size() - 1, but since we don't want to draw more than 2 indicators, we just stop after 2 iterations so we can just hard k = -2 instead
        // we can use the below loop to draw arbitrary eventsByMonthAndYearMap based on the current screen size, for example, larger screens should be able to
        // display more than 2 evens before displaying plus indicator, but don't draw more than 3 indicators for now
        for (int j = 0, k = -2; j < 3; j++, k += 2) {
            Event event = eventsList.get(j);
            float xStartPosition = xPosition + (xIndicatorOffset * k);
            if (j == 2) {
                dayPaint.setColor(multiEventIndicatorColor);
                dayPaint.setStrokeWidth(multiDayIndicatorStrokeWidth);
                canvas.drawLine(xStartPosition - smallIndicatorRadius, yPosition, xStartPosition + smallIndicatorRadius, yPosition, dayPaint);
                canvas.drawLine(xStartPosition, yPosition - smallIndicatorRadius, xStartPosition, yPosition + smallIndicatorRadius, dayPaint);
                dayPaint.setStrokeWidth(0);
            } else {
                drawEventIndicatorCircle(canvas, xStartPosition, yPosition, event.getColor());
            }
        }
    }
986630
function () {
            var series = this,
              chart = series.chart,
              options = series.options,
              borderWidth = series.borderWidth = pick(
                options.borderWidth,
                series.activePointCount > 0.5 * series.xAxis.len ? 0 : 1
              ),
              yAxis = series.yAxis,
              threshold = options.threshold,
              translatedThreshold = series.translatedThreshold = yAxis.getThreshold(threshold),
              minPointLength = pick(options.minPointLength, 5),
              metrics = series.getColumnMetrics(),
              pointWidth = metrics.width,
              seriesBarW = series.barW = mathMax(pointWidth, 1 + 2 * borderWidth), // postprocessed for border width
              pointXOffset = series.pointXOffset = metrics.offset,
              xCrisp = -(borderWidth % 2 ? 0.5 : 0),
              yCrisp = borderWidth % 2 ? 0.5 : 1;

            if (chart.renderer.isVML && chart.inverted) {
                yCrisp += 1;
            }

            // When the pointPadding is 0, we want the columns to be packed tightly, so we allow individual
            // columns to have individual sizes. When pointPadding is greater, we strive for equal-width
            // columns (#2694).
            if (options.pointPadding) {
                seriesBarW = mathCeil(seriesBarW);
            }

            Series.prototype.translate.apply(series);

            // Record the new values
            each(series.points, function (point) {
                var yBottom = pick(point.yBottom, translatedThreshold),
                  plotY = mathMin(mathMax(-999 - yBottom, point.plotY), yAxis.len + 999 + yBottom), // Don't draw too far outside plot area (#1303, #2241)
                  barX = point.plotX + pointXOffset,
                  barW = seriesBarW,
                  barY = mathMin(plotY, yBottom),
                  right,
                  bottom,
                  fromTop,
                  barH = mathMax(plotY, yBottom) - barY;

                // Handle options.minPointLength
                if (mathAbs(barH) < minPointLength) {
                    if (minPointLength) {
                        barH = minPointLength;
                        barY =
                          mathRound(mathAbs(barY - translatedThreshold) > minPointLength ? // stacked
                          yBottom - minPointLength : // keep position
                          translatedThreshold - (yAxis.translate(point.y, 0, 1, 0, 1) <= translatedThreshold ? minPointLength : 0)); // use exact yAxis.translation (#1485)
                    }
                }

                // Cache for access in polar
                point.barX = barX;
                point.pointWidth = pointWidth;

                // Fix the tooltip on center of grouped columns (#1216, #424)
                point.tooltipPos = chart.inverted ?
                  [yAxis.len - plotY, series.xAxis.len - barX - barW / 2] :
                  [barX + barW / 2, plotY + yAxis.pos - chart.plotTop];

                // Round off to obtain crisp edges and avoid overlapping with neighbours (#2694)
                right = mathRound(barX + barW) + xCrisp;
                barX = mathRound(barX) + xCrisp;
                barW = right - barX;

                fromTop = mathAbs(barY) < 0.5;
                bottom = mathRound(barY + barH) + yCrisp;
                barY = mathRound(barY) + yCrisp;
                barH = bottom - barY;

                // Top edges are exceptions
                if (fromTop) {
                    barY -= 1;
                    barH += 1;
                }

                // Register shape type and arguments to be used in drawPoints
                point.shapeType = 'rect';
                point.shapeArgs = {
                    x: barX,
                    y: barY,
                    width: barW,
                    height: barH
                };

            });

        }
512917
def draw(self, X, y, **kwargs):
        
        nan_col_counts = self.get_nan_col_counts()

        # the x locations for the groups
        self.ind = np.arange(len(self.features_))

        if y is None:
            self.ax.barh(self.ind - self.width / 2, nan_col_counts, self.width,
                            color=self.color, label=None)
        else:
            self.draw_stacked_bar(nan_col_counts)
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'"
            )
707146
function DrawVerticalTick($which_ylab,$which_ypos) {  //ylab in world coord.
    //Draw Just one Tick, called from DrawVerticalTicks
    //Ticks and datalables can be left of plot only, right of plot only,
    //  both on the left and right of plot, or crossing a user defined Y-axis
    //
    //Its faster to draw both left and right ticks at same time
    //  than first left and then right.

    if ($this->y_axis_position != "") {
      //Ticks and lables are drawn on the left border of yaxis
      $yaxis_x = $this->xtr($this->y_axis_position);
    } else {
      //Ticks and lables are drawn on the left border of PlotArea.
      $yaxis_x = $this->plot_area[0];
    }

    $y_pixels = $this->ytr($which_ypos);

    //Lines Across the Plot Area
    if ($this->draw_y_grid == 1) {
      ImageLine($this->img,$this->plot_area[0]+1,$y_pixels,
        $this->plot_area[2]-1,$y_pixels,$this->ndx_light_grid_color);
    }

    //Ticks to the Left of the Plot Area
    if (($this->vert_tick_position == "plotleft") || ($this->vert_tick_position == "both") ) {
      ImageLine($this->img,(-$this->tick_length+$yaxis_x),
      $y_pixels,$yaxis_x,
      $y_pixels, $this->ndx_tick_color);
    }

    //Ticks to the Right of the Plot Area
    if (($this->vert_tick_position == "plotright") || ($this->vert_tick_position == "both") ) {
      ImageLine($this->img,($this->plot_area[2]+$this->tick_length),
      $y_pixels,$this->plot_area[2],
      $y_pixels,$this->ndx_tick_color);
    }

    //Ticks on the Y Axis
    if (($this->vert_tick_position == "yaxis") ) {
      ImageLine($this->img,($yaxis_x - $this->tick_length),
      $y_pixels,$yaxis_x,$y_pixels,$this->ndx_tick_color);
    }

    //DataLabel
//ajo working
    //$this->DrawText($this->y_label_ttffont, 0,($yaxis_x - $this->y_label_width - $this->tick_length/2),
    //		$y_pixels, $this->ndx_text_color, $this->axis_ttffont_size, $which_ylab);
    ImageString($this->img, $this->small_font, ($yaxis_x - $this->y_label_width - $this->tick_length/2),
      ( -($this->small_font_height/2.0) + $y_pixels),$which_ylab, $this->ndx_text_color);
  }