bloomberg/bqplot · pyplot.py
python logo
def scatter(x, y, **kwargs):
    """Draw a scatter in the current context figure.

    Parameters
    ----------

    x: numpy.ndarray, 1d
        The x-coordinates of the data points.
    y: numpy.ndarray, 1d
        The y-coordinates of the data points.
    options: dict (default: {})
        Options for the scales to be created. If a scale labeled 'x' is
        required for that mark, options['x'] contains optional keyword
        arguments for the constructor of the corresponding scale type.
    axes_options: dict (default: {})
        Options for the axes to be created. If an axis labeled 'x' is required
        for that mark, axes_options['x'] contains optional keyword arguments
        for the constructor of the corresponding axis type.
    """
    kwargs['x'] = x
    kwargs['y'] = y
    return _draw_mark(Scatter, **kwargs)
Similar code snippets
1.
maartenbreddels/ipyvolume · widgets.py
Match rating: 64.6% · See similar code snippets
python logo
def scatter(x, y, z, color=(1, 0, 0), s=0.01):
    global _last_figure
    fig = _last_figure
    if fig is None:
        fig = volshow(None)
    fig.scatter = Scatter(x=x, y=y, z=z, color=color, size=s)
    fig.volume.scatter = fig.scatter
    return fig
2.
SheffieldML/GPy · plot_definitions.py
Match rating: 60.7% · See similar code snippets
python logo
def scatter(self, ax, X, Y, Z=None, color=Tango.colorsHex['mediumBlue'], label=None, marker='o', **kwargs):
        if Z is not None:
            return ax.scatter(X, Y, c=color, zs=Z, label=label, marker=marker, **kwargs)
        return ax.scatter(X, Y, c=color, label=label, marker=marker, **kwargs)
3.
pandas-dev/pandas · _core.py
Match rating: 60.38% · See similar code snippets
python logo
def scatter(self, x, y, s=None, c=None, **kwds):
        """
        Create a scatter plot with varying marker point size and color.

        The coordinates of each point are defined by two dataframe columns and
        filled circles are used to represent each point. This kind of plot is
        useful to see complex correlations between two variables. Points could
        be for instance natural 2D coordinates like longitude and latitude in
        a map or, in general, any pair of metrics that can be plotted against
        each other.

        Parameters
        ----------
        x : int or str
            The column name or column position to be used as horizontal
            coordinates for each point.
        y : int or str
            The column name or column position to be used as vertical
            coordinates for each point.
        s : scalar or array_like, optional
            The size of each point. Possible values are:

            - A single scalar so all points have the same size.

            - A sequence of scalars, which will be used for each point's size
              recursively. For instance, when passing [2,14] all points size
              will be either 2 or 14, alternatively.

        c : str, int or array_like, optional
            The color of each point. Possible values are:

            - A single color string referred to by name, RGB or RGBA code,
              for instance 'red' or '#a98d19'.

            - A sequence of color strings referred to by name, RGB or RGBA
              code, which will be used for each point's color recursively. For
              instance ['green','yellow'] all points will be filled in green or
              yellow, alternatively.

            - A column name or position whose values will be used to color the
              marker points according to a colormap.

        **kwds
            Keyword arguments to pass on to :meth:`DataFrame.plot`.

        Returns
        -------
        :class:`matplotlib.axes.Axes` or numpy.ndarray of them

        See Also
        --------
        matplotlib.pyplot.scatter : Scatter plot using multiple input data
            formats.

        Examples
        --------
        Let's see how to draw a scatter plot using coordinates from the values
        in a DataFrame's columns.

        .. plot::
            :context: close-figs

            >>> df = pd.DataFrame([[5.1, 3.5, 0], [4.9, 3.0, 0], [7.0, 3.2, 1],
            ...                    [6.4, 3.2, 1], [5.9, 3.0, 2]],
            ...                   columns=['length', 'width', 'species'])
            >>> ax1 = df.plot.scatter(x='length',
            ...                       y='width',
            ...                       c='DarkBlue')

        And now with the color determined by a column as well.

        .. plot::
            :context: close-figs

            >>> ax2 = df.plot.scatter(x='length',
            ...                       y='width',
            ...                       c='species',
            ...                       colormap='viridis')
        """
        return self(kind='scatter', x=x, y=y, c=c, s=s, **kwds)
4.
KeplerGO/K2fov · projection.py
Match rating: 59.0% · See similar code snippets
python logo
def scatter(self,  ra_deg, dec_deg, *args, **kwargs):
        x,y = self.skyToPix(ra_deg, dec_deg)
        mp.scatter(x,y, *args, **kwargs)
5.
timkpaine/lantern · plot_plotly.py
Match rating: 57.77% · See similar code snippets
python logo
def scatter(self, data, color=None, x=None, y=None,  y_axis='left', subplot=False, **kwargs):
        # Scatter all
        for i, col in enumerate(data):
            if i == 0:
                continue  # don't scatter against self
            x = data.columns[0]
            y = data.columns[i]
            c = get_color(i, col, color)
            fig = go.Figure(data=[go.Scatter(
                            x=data[x],
                            y=data[y],
                            mode='markers',
                            marker={'color': c},
                            name='%s vs %s' % (x, y),
                            **kwargs)])
            self.figures.append((col, fig, y_axis, c))
6.
maartenbreddels/ipyvolume · widgets.py
Match rating: 57.36% · See similar code snippets
python logo
def quickscatter(x, y, z, **kwargs):
    ipv.figure()
    ipv.scatter(x, y, z, **kwargs)
    return ipv.gcc()
7.
zkbt/the-friendly-stars · constellation.py
Match rating: 56.9% · See similar code snippets
python logo
def plot(self, sizescale=10, color=None, alpha=0.5, label=None, edgecolor='none', **kw):
        '''
        Plot the ra and dec of the coordinates,
        at a given epoch, scaled by their magnitude.

        (This does *not* create a new empty figure.)

        Parameters
        ----------
        sizescale : (optional) float
            The marker size for scatter for a star at the magnitudelimit.
        color : (optional) any valid color
            The color to plot (but there is a default for this catalog.)
        **kw : dict
            Additional keywords will be passed on to plt.scatter.

        Returns
        -------

        plotted : outputs from the plots
        '''
        # calculate the sizes of the stars (logarithmic with brightness?)
        size = np.maximum(sizescale*(1 + self.magnitudelimit - self.magnitude), 1)

        # make a scatter plot of the RA + Dec
        scatter = plt.scatter(self.ra, self.dec,
                                    s=size,
                                    color=color or self.color,
                                    label=label or '{} ({:.1f})'.format(self.name, self.epoch),
                                    alpha=alpha,
                                    edgecolor=edgecolor,
                                    **kw)

        return scatter
8.
perimosocordiae/viztricks · convenience.py
Match rating: 55.95% · See similar code snippets
python logo
def plot(X, marker='.', kind='plot', title=None, fig='current', ax=None,
         **kwargs):
  '''General plotting function that aims to cover most common cases.
  X : numpy array of 1d, 2d, or 3d points, with one point per row.
  marker : passed to the underlying plotting function
  kind : one of {plot, scatter} that controls the plot type.
  title : if given, used as the axis title
  fig : a matplotlib.Figure, or one of {current, new}. Only used when ax=None.
  ax : a matplotlib.Axes object, or None
  All other keyword arguments are passed on to the underlying plotting function.
  '''
  X = np.asanyarray(X)
  if X.ndim not in (1,2) or (X.ndim == 2 and X.shape[1] not in (1,2,3)):
    raise ValueError('Input data must be rows of 1, 2, or 3 dimensional points')
  is_3d = X.ndim == 2 and X.shape[1] == 3
  is_1d = X.ndim == 1 or X.shape[1] == 1
  ax = _get_axis(fig, ax, is_3d)
  # XXX: support old-style scatter=True kwarg usage
  if kwargs.get('scatter', False):
    kind = 'scatter'
    del kwargs['scatter']
  # Do the plotting
  if kind is 'scatter':
    if is_1d:
      ax.scatter(np.arange(len(X)), X, marker=marker, **kwargs)
    elif is_3d:
      ax.scatter(X[:,0], X[:,1], X[:,2], marker=marker, **kwargs)
    else:
      ax.scatter(X[:,0], X[:,1], marker=marker, **kwargs)
  elif kind is 'plot':
    if is_1d:
      ax.plot(X, marker, **kwargs)
    elif is_3d:
      ax.plot(X[:,0], X[:,1], X[:,2], marker, **kwargs)
    else:
      ax.plot(X[:,0], X[:,1], marker, **kwargs)
  else:
    raise ValueError('Unsupported kind: %r' % kind)
  if title:
    ax.set_title(title)
  return plt.show
9.
pyecharts/pyecharts · scatter_example.py
Match rating: 55.81% · See similar code snippets
python logo
def scatter_base() -> Scatter:
    c = (
        Scatter()
        .add_xaxis(Faker.choose())
        .add_yaxis("商家A", Faker.values())
        .set_global_opts(title_opts=opts.TitleOpts(title="Scatter-基本示例"))
    )
    return c
10.
jor-/util · plot.py
Match rating: 55.5% · See similar code snippets
python logo
def scatter(x, y, file, point_size=20, dpi=800):
    ## check and prepare input
    if x.ndim == 2 and x.shape[1] > 2:
        raise ValueError('Scatter plots for x dim {} is not supported.'.format(x.shape[1]))
    if x.ndim == 2 and x.shape[1] == 1:
        x = x[:,0]

    ## make figure
    fig = plt.figure()

    ## plot
    if x.ndim == 1:
        plt.scatter(x, y, s=point_size)
    if x.ndim == 2:
        ax = fig.add_subplot(111, projection='3d')
        ax.scatter(x[:,0], x[:,1], y, s=point_size)

    ## save and close
    save_and_close_fig(fig, file, dpi=dpi)