Draw a funnel slice
515310
def funnel(self, serie):
        """"""
        serie_node = self.svg.serie(serie)
        fmt = lambda x: '%f %f' % x
        for i, poly in enumerate(serie.points):
            metadata = serie.metadata.get(i)
            val = self._format(serie, i)

            funnels = decorate(
                self.svg, self.svg.node(serie_node['plot'], class_="funnels"),
                metadata
            )

            alter(
                self.svg.node(
                    funnels,
                    'polygon',
                    points=' '.join(map(fmt, map(self.view, poly))),
                    class_='funnel reactive tooltip-trigger'
                ), metadata
            )

            # Poly center from label
            x, y = self.view((
                self._center(self._x_pos[serie.index]),
                sum([point[1] for point in poly]) / len(poly)
            ))
            self._tooltip_data(
                funnels, val, x, y, 'centered', self._get_x_label(serie.index)
            )
            self._static_value(serie_node, val, x, y, metadata)
240645
def draw(self):
        '''
        
        '''
        return np.random.uniform(loc=self.__low, scale=self.__high, size=self.__output_shape)
496789
function (_e) {
										_draw(_e[0], uip);
										_currentInstance.removeClass(_e[0], "jsplumb-dragged");
										_currentInstance.select({source: _e[0]}).removeClass(_currentInstance.elementDraggingClass + " " + _currentInstance.sourceElementDraggingClass, true);
										_currentInstance.select({target: _e[0]}).removeClass(_currentInstance.elementDraggingClass + " " + _currentInstance.targetElementDraggingClass, true);
										_currentInstance.getDragManager().dragEnded(_e[0]);
									}
9320
function drawHandles() {
            let handleFillColor = colorHelper.colorSchemasHuman.grey[1];

            // Styling
            handle = chartBrush
                        .selectAll('.handle.brush-rect')
                        .style('fill', handleFillColor);
        }
600201
def make_cutter(self):
        
        return cadquery.Workplane('XY') \
            .circle(self.access_diameter / 2) \
            .extrude(self.access_height)
1318265
private void highlightSlice(PieModel _Slice) {

        int color = _Slice.getColor();
        _Slice.setHighlightedColor(Color.argb(
                0xff,
                Math.min((int) (mHighlightStrength * (float) Color.red(color)), 0xff),
                Math.min((int) (mHighlightStrength * (float) Color.green(color)), 0xff),
                Math.min((int) (mHighlightStrength * (float) Color.blue(color)), 0xff)
        ));
    }
503656
function drawConnectors(dv) {
    if (!dv.showDifferences) return;

    if (dv.svg) {
      clear(dv.svg);
      var w = dv.gap.offsetWidth;
      attrs(dv.svg, "width", w, "height", dv.gap.offsetHeight);
    }
    clear(dv.copyButtons);

    var flip = dv.type == "left";
    var vpEdit = dv.edit.getViewport(), vpOrig = dv.orig.getViewport();
    var sTopEdit = dv.edit.getScrollInfo().top, sTopOrig = dv.orig.getScrollInfo().top;
    iterateChunks(dv.diff, function(topOrig, botOrig, topEdit, botEdit) {
      if (topEdit > vpEdit.to || botEdit < vpEdit.from ||
          topOrig > vpOrig.to || botOrig < vpOrig.from)
        return;
      var topLpx = dv.orig.heightAtLine(topOrig, "local") - sTopOrig, top = topLpx;
      if (dv.svg) {
        var topRpx = dv.edit.heightAtLine(topEdit, "local") - sTopEdit;
        if (flip) { var tmp = topLpx; topLpx = topRpx; topRpx = tmp; }
        var botLpx = dv.orig.heightAtLine(botOrig, "local") - sTopOrig;
        var botRpx = dv.edit.heightAtLine(botEdit, "local") - sTopEdit;
        if (flip) { var tmp = botLpx; botLpx = botRpx; botRpx = tmp; }
        var curveTop = " C " + w/2 + " " + topRpx + " " + w/2 + " " + topLpx + " " + (w + 2) + " " + topLpx;
        var curveBot = " C " + w/2 + " " + botLpx + " " + w/2 + " " + botRpx + " -1 " + botRpx;
        attrs(dv.svg.appendChild(document.createElementNS(svgNS, "path")),
              "d", "M -1 " + topRpx + curveTop + " L " + (w + 2) + " " + botLpx + curveBot + " z",
              "class", dv.classes.connect);
      }
      var copy = dv.copyButtons.appendChild(elt("div", dv.type == "left" ? "\u21dd" : "\u21dc",
                                                "CodeMirror-merge-copy"));
      copy.title = "Revert chunk";
      copy.chunk = {topEdit: topEdit, botEdit: botEdit, topOrig: topOrig, botOrig: botOrig};
      copy.style.top = top + "px";
    });
  }
49865
def generate_slices(slices, minsize, maxsize, bounded=True):
  """"""

  if isinstance(slices, integer_types) or isinstance(slices, floating_types):
    slices = [ slice(int(slices), int(slices)+1, 1) ]
  elif type(slices) == slice:
    slices = [ slices ]
  elif slices == Ellipsis:
    slices = []

  slices = list(slices)

  for index, slc in enumerate(slices):
    if slc == Ellipsis:
      fill = len(maxsize) - len(slices) + 1
      slices = slices[:index] +  (fill * [ slice(None, None, None) ]) + slices[index+1:]
      break

  while len(slices) < len(maxsize):
    slices.append( slice(None, None, None) )

  # First three slices are x,y,z, last is channel. 
  # Handle only x,y,z here, channel seperately
  for index, slc in enumerate(slices):
    if isinstance(slc, integer_types) or isinstance(slc, floating_types):
      slices[index] = slice(int(slc), int(slc)+1, 1)
    elif slc == Ellipsis:
      raise ValueError("More than one Ellipsis operator used at once.")
    else:
      start = minsize[index] if slc.start is None else slc.start
      end = maxsize[index] if slc.stop is None else slc.stop 
      step = 1 if slc.step is None else slc.step

      if step < 0:
        raise ValueError('Negative step sizes are not supported. Got: {}'.format(step))

      # note: when unbounded, negative indicies do not refer to
      # the end of the volume as they can describe, e.g. a 1px
      # border on the edge of the beginning of the dataset as in
      # marching cubes.
      if bounded:
        # if start < 0: # this is support for negative indicies
          # start = maxsize[index] + start         
        check_bounds(start, minsize[index], maxsize[index])
        # if end < 0: # this is support for negative indicies
        #   end = maxsize[index] + end
        check_bounds(end, minsize[index], maxsize[index])

      slices[index] = slice(start, end, step)

  return slices
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)
186451
function drawStackedAreas() {
            // Not ideal, we need to figure out how to call exit for nested elements
            if (series) {
                svg.selectAll('.layer-container').remove();
                svg.selectAll('.layer').remove();
                svg.selectAll('.area-outline').remove();
            }

            if (isUsingFakeData) {
                drawEmptyDataLine();

                return;
            }

            area = d3Shape.area()
                .curve(curveMap[areaCurve])
                .x(({data})=> xScale(data.date))
                .y0((d) => yScale(d[0]))
                .y1((d) => yScale(d[1]));

            areaOutline = d3Shape.line()
                .curve(area.curve())
                .x(({data}) => xScale(data.date))
                .y((d) => yScale(d[1]));

            if (isAnimated) {
                series = svg.select('.chart-group').selectAll('.layer')
                    .data(layersInitial, getName)
                    .enter()
                      .append('g')
                        .classed('layer-container', true);

                series
                  .append('path')
                    .attr('class', 'layer')
                    .attr('d', area)
                    .style('opacity', areaOpacity)
                    .style('fill', ({key}) => categoryColorMap[key]);

                series
                  .append('path')
                    .attr('class', 'area-outline')
                    .attr('d', areaOutline)
                    .style('stroke', ({key}) => categoryColorMap[key]);

                // Update
                svg.select('.chart-group').selectAll('.layer')
                    .data(layers)
                    .transition()
                    .delay((_, i) => areaAnimationDelays[i])
                    .duration(areaAnimationDuration)
                    .ease(ease)
                    .attr('d', area)
                    .style('opacity', areaOpacity)
                    .style('fill', ({key}) => categoryColorMap[key]);

                svg.select('.chart-group').selectAll('.area-outline')
                    .data(layers)
                    .transition()
                    .delay( (_, i) => areaAnimationDelays[i])
                    .duration(areaAnimationDuration)
                    .ease(ease)
                    .attr('d', areaOutline);

            } else {
                series = svg.select('.chart-group').selectAll('.layer')
                    .data(layers)
                    .enter()
                      .append('g')
                        .classed('layer-container', true);

                series
                  .append('path')
                    .attr('class', 'layer')
                    .attr('d', area)
                    .style('opacity', areaOpacity)
                    .style('fill', ({key}) => categoryColorMap[key]);

                series
                  .append('path')
                    .attr('class', 'area-outline')
                    .attr('d', areaOutline)
                    .style('stroke', ({key}) => categoryColorMap[key]);


                // Update
                svg.select('.chart-group').selectAll('.layer')
                    .attr('d', area)
                    .style('opacity', areaOpacity)
                    .style('fill', ({key}) => categoryColorMap[key]);

                svg.select('.chart-group').selectAll('.area-outline')
                    .attr('class', 'area-outline')
                    .attr('d', areaOutline)
                    .style('stroke', ({key}) => categoryColorMap[key]);
            }

            if (!hasOutline) {
                svg.select('.chart-group')
                  .selectAll('.area-outline')
                  .style('display', 'none');
            }

            // Exit
            series.exit()
                .transition()
                .style('opacity', 0)
                .remove();
        }
225236
def draw_objects(self, objects, bounds, img):
        ''''''
        keys = objects.keys()
        keys.sort()
        for k in keys:
            obj = objects[k]
            bounds2 = obj.bounds()
            if bounds2 is None or mp_util.bounds_overlap(bounds, bounds2):
                obj.draw(img, self.pixmapper, bounds)
1217994
def slices(self):
        
        labels = self.labels
        values = self.data
        hole_percentage = self.inner_radius_ratio
        radius = self.DEFAULT_RADIUS
        hole = hole_percentage * radius
        colors = self.colors
        stroke_color = self.stroke_color

        slices_return = []
        total_values = self.total_value
        angle = - math.pi / 2
        center_point = (128, 128)
        label_position = (256, 0)
        for idx, v in enumerate(values):

            color = colors[idx]
            label = labels[idx]

            if v == total_values:
                # This is 100% slice. SVG renderer sometimes can't render 100%
                # arc slice properly. We use a workaround for this. Draw 2
                # slice instead with 50% value and 50% value
                half_slice = self._arc_slice_context(
                    total_values / 2,
                    total_values,
                    label,
                    color,
                    # stroke color should be the same with color
                    # because in this case, it should look like a circle
                    color,
                    radius,
                    label_position,
                    angle,
                    center_point,
                    hole)

                if half_slice is None:
                    continue

                # modify the result
                half_slice['value'] = total_values
                half_slice['percentage'] = 100

                slices_return.append(half_slice)

                # Create another slice. This time, without the label
                angle += math.pi
                half_slice = self._arc_slice_context(
                    total_values / 2,
                    total_values,
                    # No label for this slice. Since this is just a dummy.
                    '',
                    color,
                    # stroke color should be the same with color
                    # because in this case, it should look like a circle
                    color,
                    radius,
                    label_position,
                    angle,
                    center_point,
                    hole)

                half_slice['show_label'] = False

                slices_return.append(half_slice)
                continue

            one_slice = self._arc_slice_context(
                v,
                total_values,
                label,
                color,
                stroke_color,
                radius,
                label_position,
                angle,
                center_point,
                hole)

            step_angle = 1.0 * v / total_values * 2 * math.pi
            angle += step_angle

            slices_return.append(one_slice)

        return slices_return
234470
function drawWithKids(list, cb)
        {
            if (list.length == 0)
                return cb();
            var p = list.pop();
            var win = p.win;
            if (win == dispwin)
                return drawWithKids(list, cb);

            X.GetWindowAttributes(win, function(err, res) {
                if (res[8] == 0)
                    return drawWithKids(list, cb);
                X.GetGeometry(win, function(err, geom) {
                    // (srcDrawable, dstDrawable, gc, srcX, srcY, dstX, dstY, width, height)
                    if (win != root)
                        X.CopyArea(win, dispwin, gc, 0, 0, p.x + geom.xPos, p.y + geom.yPos, geom.width, geom.height);
                    //X.CopyArea(win, idScreenshot, gc, 0, 0, p.x + geom.xPos, p.y + geom.yPos, geom.width, geom.height);
                    X.QueryTree(win, function(tree) {
                        tree.children.reverse().forEach(function(subwin) {
                            list.push({win: subwin, x: p.x + geom.xPos, y: p.y + geom.yPos});
                        });
                        drawWithKids(list, cb);
                    });
                });
            });
        }
142475
def pick_slices(img, num_slices_per_view):
    

    slices = list()
    for view in range(len(img.shape)):
        dim_size = img.shape[view]
        non_empty_slices = np.array(
            [sl for sl in range(dim_size) if np.count_nonzero(get_axis(img, view, sl)) > 0])
        num_non_empty = len(non_empty_slices)

        # trying to 5% slices at the tails (bottom clipping at 0)
        skip_count = max(0, np.around(num_non_empty * 0.05).astype('int16'))
        # only when possible
        if skip_count > 0 and (num_non_empty - 2 * skip_count >= num_slices_per_view):
            non_empty_slices = non_empty_slices[skip_count: -skip_count]
            num_non_empty = len(non_empty_slices)

        # sampling non-empty slices only
        sampled_indices = np.linspace(0, num_non_empty, num=min(num_non_empty, num_slices_per_view),
                                      endpoint=False)
        slices_in_dim = non_empty_slices[np.around(sampled_indices).astype('int64')]

        # ensure you do not overshoot
        slices_in_dim = [sn for sn in slices_in_dim if sn >= 0 or sn <= num_non_empty]

        slices.append(slices_in_dim)

    return slices
667186
def __drawSegmentedSlice(self, ax, contour, i):
        
        i = int(i)
        ax.cla()
        ax.imshow(self.data[i, :, :], cmap=self.cmap)

        ax.set_xticklabels([])
        ax.set_yticklabels([])
        if contour is not None:
            #ax.contour(contour[i, :, :])
            logger.debug("type contour " + str(type(contour)))
            logger.debug("max contour " + str(np.max(contour)))
            logger.debug("min contour " + str(np.min(contour)))
            logger.debug("type contour " + str(type(contour[i,:,:])))
            logger.debug("max contour " + str(np.max(contour[i,:,:])))
            logger.debug("min contour " + str(np.min(contour[i,:,:])))
            contour_slice = contour[i, :, :]
            if np.max(contour_slice) != np.min(contour_slice):
                ax.contour(contour[i, :, :] + 1)
1191163
def draw(self):
        '''
        
        '''
        observed_arr = self.noise_sampler.generate()
        _ = self.__encoder_decoder_controller.encoder.inference(observed_arr)
        arr = self.__encoder_decoder_controller.encoder.get_feature_points()
        return arr
1153292
def draw(molecule, TraversalType=SmilesTraversal):
    """"""
    result = []
    atoms = allAtoms = molecule.atoms

    visitedAtoms = {}
    #
    # Traverse all components of the graph to form
    # the output string
    while atoms:
        atom = _get_lowest_symorder(atoms)
        visitedAtoms[atom] = 1

        visitedBonds = {}
        nextTraverse = TraversalType()
        atomsUsed, bondsUsed = [], []
        _traverse(atom, nextTraverse, None,
                  visitedAtoms, visitedBonds,
                  atomsUsed, bondsUsed, TraversalType)
        atoms = []
        for atom in allAtoms:
            if not visitedAtoms.has_key(atom):
                atoms.append(atom)
        assert nextTraverse.atoms == atomsUsed
        assert nextTraverse.bonds == bondsUsed, "%s %s"%(
            nextTraverse.bonds, bondsUsed)
        

        result.append((str(nextTraverse),
                       atomsUsed, bondsUsed))

    result.sort()
    fragments = []
    for r in result:
        fragments.append(r[0])

    return ".".join(fragments), result