Scatter plot of 1D histogram values.

    Points are horizontally placed in bin centers.

    Parameters
    ----------
    shape : str
322684
def scatter(h1: Histogram1D, **kwargs) -> dict:
    
    shape = kwargs.pop("shape", DEFAULT_SCATTER_SHAPE)
    # size = kwargs.pop("size", DEFAULT_SCATTER_SIZE)

    mark_template = [{
        "type": "symbol",
        "from": {"data": "series"},
        "encode": {
            "enter": {
                "x": {"scale": "xscale", "field": "x"},
                "y": {"scale": "yscale", "field": "y"},
                "shape": {"value": shape},
                # "size": {"value": size},
                "fill": {"scale": "series", "field": "c"},
            },
        }
    }]
    vega = _scatter_or_line(h1, mark_template=mark_template, kwargs=kwargs)
    return vega
431512
def _areadist(ax, v, xr, c, bins=100, by=None, alpha=1, label=None):
    
    y, x = np.histogram(v[~np.isnan(v)], bins)
    x = x[:-1]

    if by is None:
        by = np.zeros((bins,))

    ax.fill_between(x, y, by, facecolor=c, alpha=alpha, label=label)
    return y
348907
def shape(self) -> Tuple[int, ...]:
        
        return tuple(bins.bin_count for bins in self._binnings)
310702
def create_scatterplot(df):
    
    fig = Figure("/mg/scatter/", "mg_scatter")
    fig.layout.set_size(width=450, height=200)
    fig.layout.set_margin(left=40, right=40)
    fig.graphics.animate_on_load()

    init_params = {"Data": "Steps"}

    def get_data():
        y = request.args.get("Data", "Steps")
        return jsonify(ScatterPlot.to_json(df, "Steps", y))

    # Make a histogram with 20 bins
    return ScatterPlot(df, fig, "Steps", "Distance",
        init_params={}, route_func=get_data)
709507
def scatter(data, color=None, point_size=2, f_tooltip=None):
    
    import warnings
    warnings.warn("deprecated, use geoplotlib.dot", DeprecationWarning)
    dot(data, color, point_size, f_tooltip)
840928
def scatter(h1: Histogram1D, ax: Axes, *, errors: bool = False, **kwargs):
    """"""
    show_stats = kwargs.pop("show_stats", False)
    show_values = kwargs.pop("show_values", False)
    density = kwargs.pop("density", False)
    cumulative = kwargs.pop("cumulative", False)
    value_format = kwargs.pop("value_format", None)
    text_kwargs = pop_kwargs_with_prefix("text_", kwargs)

    data = get_data(h1, cumulative=cumulative, density=density)

    if "cmap" in kwargs:
        cmap = _get_cmap(kwargs)
        _, cmap_data = _get_cmap_data(data, kwargs)
        kwargs["color"] = cmap(cmap_data)
    else:
        kwargs["color"] = kwargs.pop("color", "blue")

    _apply_xy_lims(ax, h1, data, kwargs)
    _add_ticks(ax, h1, kwargs)
    _add_labels(ax, h1, kwargs)

    if errors:
        err_data = get_err_data(h1, cumulative=cumulative, density=density)
        ax.errorbar(h1.bin_centers, data, yerr=err_data, fmt=kwargs.pop("fmt", "o"),
                    ecolor=kwargs.pop("ecolor", "black"), ms=0)
    ax.scatter(h1.bin_centers, data, **kwargs)

    if show_values:
        _add_values(ax, h1, data, value_format=value_format, **text_kwargs)
    if show_stats:
        _add_stats_box(h1, ax, stats=show_stats)
1139282
def shape(self):
        
        bf = self.copy()
        content = requests.get(bf.dataset_url).json()
        rowCount = content['status']['rowCount']
        valueCount = content['status']['valueCount']

        return (rowCount, valueCount)
755589
def _block_shape(values, ndim=1, shape=None):
    
    if values.ndim < ndim:
        if shape is None:
            shape = values.shape
        if not is_extension_array_dtype(values):
            # TODO: https://github.com/pandas-dev/pandas/issues/23023
            # block.shape is incorrect for "2D" ExtensionArrays
            # We can't, and don't need to, reshape.
            values = values.reshape(tuple((1, ) + shape))
    return values
1293169
def bin_centers(self, axis=None):
        """"""
        if axis is None:
            return np.array([self.bin_centers(axis=i) for i in range(self.dimensions)])
        axis = self.get_axis_number(axis)
        return 0.5 * (self.bin_edges[axis][1:] + self.bin_edges[axis][:-1])
805306
def shape(self, i=0):
        """"""
        shp = self.__getFileObj(self.shp)
        i = self.__restrictIndex(i)
        offset = self.__shapeIndex(i)
        if not offset:
            # Shx index not available so iterate the full list.
            for j,k in enumerate(self.iterShapes()):
                if j == i:
                    return k
        shp.seek(offset)
        return self.__shape()
1111752
def stem_leaf_plot(data, vmin, vmax, bins, digit=1, title=None):
    '''
    
    '''
    assert bins > 0
    range = vmax - vmin
    step = range * 1. / bins
    if isinstance(range, int):
        step = int(ceil(step))

    step = step or 1

    bins = np.arange(vmin, vmax + step, step)
    hist, bin_edges = np.histogram(data, bins=bins)
    # By default, len(bin_edges) = len(hist) + 1
    bin_edges = bin_edges[:len(hist)]
    asciiplot(bin_edges, hist, digit=digit, title=title)
    print("Last bin ends in {0}, inclusive.".format(vmax), file=sys.stderr)

    return bin_edges, hist
679788
def preprocess_histogram(hist, values, edges):
    """"""

    # working with extremely skewed histograms
    if np.count_nonzero(hist) == 0:
        # all of them above upper bound
        if np.all(values >= edges[-1]):
            hist[-1] = 1
        # all of them below lower bound
        elif np.all(values <= edges[0]):
            hist[0] = 1

    return hist
1128329
def shape(self):
        
        ndim = mx_int()
        pdata = ctypes.POINTER(mx_int)()
        check_call(_LIB.MXNDArrayGetShapeEx(
            self.handle, ctypes.byref(ndim), ctypes.byref(pdata)))
        if ndim.value == -1:
            return None
        else:
            return tuple(pdata[:ndim.value])
1210673
def dist_points(bin_edges, d):
    
    bc = bin_centers(bin_edges)
    if d is not None:
        d = DISTS[d['type']](d, bc)
    return d, bc
921861
def from_histogram(cls, histogram, bin_edges, axis_names=None):
        
        bin_edges = np.array(bin_edges)
        self = cls(bins=bin_edges, axis_names=axis_names)
        self.histogram = histogram
        return self
17000
def plot_probabilities_histogram(Y_p, title=None):
    
    if Y_p.ndim > 1:
        msg = (
            f"Arg Y_p should be a 1-dimensional np.ndarray, not of shape "
            f"{Y_p.shape}."
        )
        raise ValueError(msg)
    plt.hist(Y_p, bins=20)
    plt.xlim((0, 1.025))
    plt.xlabel("Probability")
    plt.ylabel("# Predictions")
    if isinstance(title, str):
        plt.title(title)
    plt.show()
406181
def tsne(adata, **kwargs) -> Union[Axes, List[Axes], None]:
    
    return plot_scatter(adata, 'tsne', **kwargs)