TODO: Docstring for spark.

    Parameters
    ----------
    points : array-like
    shapes : array-like
    fill : array-like, optional

    Returns
    -------
    Chart
7511
def spark_shape(points, shapes, fill=None, color='blue', width=5, yindex=0, heights=None):
    
    assert len(points) == len(shapes) + 1
    data = [{'marker': {'color': 'white'}, 'x': [points[0], points[-1]], 'y': [yindex, yindex]}]

    if fill is None:
        fill = [False] * len(shapes)

    if heights is None:
        heights = [0.4] * len(shapes)

    lays = []
    for i, (shape, height) in enumerate(zip(shapes, heights)):
        if shape is None:
            continue
        if fill[i]:
            fillcolor = color
        else:
            fillcolor = 'white'
        lays.append(
            dict(
                type=shape,
                x0=points[i],
                x1=points[i + 1],
                y0=yindex - height,
                y1=yindex + height,
                xref='x',
                yref='y',
                fillcolor=fillcolor,
                line=dict(color=color, width=width),
            )
        )

    layout = dict(shapes=lays)

    return Chart(data=data, layout=layout)
434255
def polygon_from_points(points):
    
    polygon = []
    for pair in points.split(" "):
        x_y = pair.split(",")
        polygon.append([float(x_y[0]), float(x_y[1])])
    return polygon
1205121
def point8_to_box(points):
    
    p = points.reshape((-1, 4, 2))
    minxy = p.min(axis=1)   # nx2
    maxxy = p.max(axis=1)   # nx2
    return np.concatenate((minxy, maxxy), axis=1)
1208431
private static List<LabeledPoint> toLabeledPoint(List<DataSet> labeledPoints) {
        List<LabeledPoint> ret = new ArrayList<>();
        for (DataSet point : labeledPoints) {
            ret.add(toLabeledPoint(point));
        }
        return ret;
    }
851510
def points(self, points):
        
        if not isinstance(points, np.ndarray):
            raise TypeError('Points must be a numpy array')
        # get the unique coordinates along each axial direction
        x = np.unique(points[:,0])
        y = np.unique(points[:,1])
        z = np.unique(points[:,2])
        nx, ny, nz = len(x), len(y), len(z)
        # TODO: this needs to be tested (unique might return a tuple)
        dx, dy, dz = np.unique(np.diff(x)), np.unique(np.diff(y)), np.unique(np.diff(z))
        ox, oy, oz = np.min(x), np.min(y), np.min(z)
        # Build the vtk object
        self._from_specs((nx,ny,nz), (dx,dy,dz), (ox,oy,oz))
        #self._point_ref = points
        self.Modified()
1180102
def canvas_points(self):
        """"""

        if self.chart():
            x_axis_min = self.chart().x_lower_limit()
            y_axis_min = self.chart().y_lower_limit()
            x_axis_max = self.chart().x_upper_limit()
            y_axis_max = self.chart().y_upper_limit()
            chart_width = self.chart().width()
            chart_height = self.chart().height()
            horizontal_padding = self.chart().horizontal_padding()
            vertical_padding = self.chart().vertical_padding()
            horizontal_margin_pixels = horizontal_padding * chart_width
            vertical_margin_pixels = vertical_padding * chart_height
            x_axis_pixels = chart_width - (2 * horizontal_margin_pixels)
            y_axis_pixels = chart_height - (2 * vertical_margin_pixels)
            x_axis_span = x_axis_max - x_axis_min
            y_axis_span = y_axis_max - y_axis_min
            x_pixels_per_point = x_axis_pixels / x_axis_span
            y_pixels_per_point = y_axis_pixels / y_axis_span
            data = []
            for x, y in self.data():
                relative_x, relative_y = x - x_axis_min, y - y_axis_min
                data.append((
                 (relative_x * x_pixels_per_point) + horizontal_margin_pixels,
                 chart_height - ((relative_y * y_pixels_per_point) + vertical_margin_pixels)
                ))
            return tuple(data)
643851
def axis_to_data_points(ax, points_axis):
    
    axis_to_data = ax.transAxes + ax.transData.inverted()
    return axis_to_data.transform(points_axis)
780567
def getPoints(self, pared=False):
        
        points = self._points[:]
        if pared:
            np = NodePare()
            np.addPoints(points)
            np.parePoints()
            points = np.getParedPoints()

        return points
1023906
def drawPolyline(self, points):
        
        for i, p in enumerate(points):
            if i == 0:
                if not (self.lastPoint == Point(p)):
                    self.draw_cont += "%g %g m\n" % JM_TUPLE(Point(p) * self.ipctm)
                    self.lastPoint = Point(p)
            else:
                self.draw_cont += "%g %g l\n" % JM_TUPLE(Point(p) * self.ipctm)
            self.updateRect(p)

        self.lastPoint = Point(points[-1])
        return self.lastPoint
1022635
def points(self, points):
        
        if not isinstance(points, np.ndarray):
            raise TypeError('Points must be a numpy array')
        vtk_points = vtki.vtk_points(points, False)
        self.SetPoints(vtk_points)
        self.GetPoints().Modified()
        self.Modified()
10458
def fill_polygon_with_points(cls, goal=None, polygon=None):
        
        if goal is None:
            raise ValueError("Must specify the number of points (goal) to fill the polygon with")

        if polygon is None or (not isinstance(polygon, Polygon) and not isinstance(polygon, MultiPolygon)):
            raise ValueError("Must specify a polygon to fill points with")

        minx = polygon.bounds[0] 
        maxx = polygon.bounds[2] 
        miny = polygon.bounds[1] 
        maxy = polygon.bounds[3] 

        points = []
        now = time.time()
        while len(points) < goal:
            random_x = random.uniform(minx, maxx)
            random_y = random.uniform(miny, maxy)
            p = Point(random_x, random_y)
            if p.within(polygon):
                points.append(p)

        logger.info("Filling polygon with points took %f seconds" % (time.time() - now))

        return points
1133076
def contours(*values)
		(values = (0..values[0]+1).to_a.map{|i| i.to_f * (@grid.max - @grid.min) / ( values[0]+1) + @grid.min}; values.pop; values.shift) if values.size==1 and values[0].kind_of? Integer
		cons = values.inject({}){|hash, val| hash[val] = []; hash}
		get_startpoints(cons)
		#@analysed = {}
		@found = {}
		#p cons
		starts = cons

		cons = values.inject({}){|hash, val| hash[val] = []; hash}
		temp_cons = values.inject({}){|hash, val| hash[val] = []; hash}
		starts.each do |val, arr|
			#p 'arr', arr
			arr.each do |start_con|
			#arr.map{|edges| edges[-1][1].slice(0..1)}.each do |starti, startj|
				starti, startj = start_con[-1][1].slice(0..1)	
				temp_cons[val] = [start_con]
				p 'startj',  starti, startj
				loop do
					starti, startj = trace_contour(val, temp_cons, starti, startj)
					break unless starti and startj
				end
				cons[val].push temp_cons[val][0]
			end
		end
		cons.keys.each{|val| cons[val] = connect_contours(cons[val]);
			cons[val].map!{|con| con.map{|point| point[0]}}}
		
		@last_contours = cons
		gk =  graphkit
		#gk.gp.style = 'data with linespoints'
		gk.data.each{|dk| dk.with = 'lp'}
		gk.gnuplot
		@last_contours
	end
991046
def points(self, points):
        
        if not isinstance(points, np.ndarray):
            raise TypeError('Points must be a numpy array')
        # get the unique coordinates along each axial direction
        x = np.unique(points[:,0])
        y = np.unique(points[:,1])
        z = np.unique(points[:,2])
        # Set the vtk coordinates
        self._from_arrays(x, y, z)
        #self._point_ref = points
        self.Modified()
800662
def points(ys, width=None):
    '''
    '''
    if width is None:
        width = terminal.width()

    ys = np.array(ys)
    n = len(ys)
    y_min, y_max = np.min(ys), np.max(ys)
    n_bins = min(width, n)
    bins_per_n = float(n_bins) / float(n)
    # print n, n_bins, n_per_bin, bins_per_n
    sums = np.zeros(n_bins)
    counts = np.zeros(n_bins)
    for i, y in enumerate(ys):
        bin = int(i * bins_per_n)
        sums[bin] += y
        counts[bin] += 1
    bin_means = sums / counts
    # we want the lowest bin_height to be 0.0, and highest bin_height to be 1.0
    bin_heights = normalize(bin_means)
    bin_chars = (bin_heights * (len(terminal.bars) - 1)).astype(int)
    # print sums, counts, bin_means
    cells = [terminal.bars[bin_char] for bin_char in bin_chars]
    print '[%+f]' % y_max
    print u''.join(cells)
    print '[%+f]' % y_min
720118
function Shape( points ) {

	Path.call( this, points );

	this.uuid = _Math.generateUUID();

	this.type = 'Shape';

	this.holes = [];

}
1224670
def point_arrays(self):
        
        pdata = self.GetPointData()
        narr = pdata.GetNumberOfArrays()

        # Update data if necessary
        if hasattr(self, '_point_arrays'):
            keys = list(self._point_arrays.keys())
            if narr == len(keys):
                if keys:
                    if self._point_arrays[keys[0]].size == self.n_points:
                        return self._point_arrays
                else:
                    return self._point_arrays

        # dictionary with callbacks
        self._point_arrays = PointScalarsDict(self)

        for i in range(narr):
            name = pdata.GetArrayName(i)
            self._point_arrays[name] = self._point_scalar(name)

        self._point_arrays.enable_callback()
        return self._point_arrays
1327238
def _make_graphite_api_points_list(influxdb_data):
    """"""
    _data = {}
    for key in influxdb_data.keys():
        _data[key[0]] = [(datetime.datetime.fromtimestamp(float(d['time'])),
                          d['value']) for d in influxdb_data.get_points(key[0])]
    return _data