hvPlot.scatter#

hvPlot.scatter(x=None, y=None, **kwds)[source]#

The scatter plot visualizes your points as markers in 2D space. You can visualize one more dimension by using colors.

The scatter plot is a good first way to plot data with non continuous axes.

Reference: https://hvplot.holoviz.org/reference/tabular/scatter.html

Parameters:
xstring, optional

Field name(s) to draw x-positions from. If not specified, the index is used. Can refer to continuous and categorical data.

ystring or list, optional

Field name(s) to draw y-positions from. If not specified, all numerical fields are used.

markerstring, optional

The marker shape specified above can be any supported by matplotlib, e.g. s, d, o etc. See https://matplotlib.org/stable/api/markers_api.html.

cstring, optional

A color or a Field name to draw the color of the marker from

sint, optional, also available as ‘size’

The size of the marker

bystring, optional

A single field or list of fields to group by. All the subgroups are visualized.

groupby: string, list, optional

A single field or list of fields to group and filter by. Adds one or more widgets to select the subgroup(s) to visualize.

scale: number, optional

Scaling factor to apply to point scaling.

logzbool

Whether to apply log scaling to the z-axis. Default is False.

colorstr or array-like, optional.

The color for each of the series. 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 series recursively. For instance [‘green’,’yellow’] each field’s line will be filled in green or yellow, alternatively. If there is only a single series to be plotted, then only the first color from the color list will be used.

**kwdsoptional

Additional keywords arguments are documented in hvplot.help(‘scatter’). See Plotting Options for more information.

Returns:
holoviews.element.Scatter / Panel object

You can print the object to study its composition and run:

import holoviews as hv
hv.help(the_holoviews_object)

to learn more about its parameters and options.

References

Examples

import hvplot.pandas
import pandas as pd

df = pd.DataFrame(
    {
        "actual": [100, 150, 125, 140, 145, 135, 123],
        "forecast": [90, 160, 125, 150, 141, 141, 120],
        "numerical": [1.1, 1.9, 3.2, 3.8, 4.3, 5.0, 5.5],
        "date": pd.date_range("2022-01-03", "2022-01-09"),
        "string": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
    },
)
scatter = df.hvplot.scatter(
    x="numerical",
    y=["actual", "forecast"],
    ylabel="value",
    legend="bottom",
    height=500,
    color=["#f16a6f", "#1e85f7"],
    size=100,
)
scatter

You can overlay the scatter markers on for example a line plot

line = df.hvplot.line(
    x="numerical", y=["actual", "forecast"], color=["#f16a6f", "#1e85f7"], line_width=5
)
scatter * line

Backend-specific styling options#

alpha, angle, cmap, color, fill_alpha, fill_color, hit_dilation, hover_alpha, hover_color, hover_fill_alpha, hover_fill_color, hover_line_alpha, hover_line_cap, hover_line_color, hover_line_dash, hover_line_dash_offset, hover_line_join, hover_line_width, line_alpha, line_cap, line_color, line_dash, line_dash_offset, line_join, line_width, marker, muted, muted_alpha, muted_color, muted_fill_alpha, muted_fill_color, muted_line_alpha, muted_line_cap, muted_line_color, muted_line_dash, muted_line_dash_offset, muted_line_join, muted_line_width, nonselection_alpha, nonselection_color, nonselection_fill_alpha, nonselection_fill_color, nonselection_line_alpha, nonselection_line_cap, nonselection_line_color, nonselection_line_dash, nonselection_line_dash_offset, nonselection_line_join, nonselection_line_width, palette, selection_alpha, selection_color, selection_fill_alpha, selection_fill_color, selection_line_alpha, selection_line_cap, selection_line_color, selection_line_dash, selection_line_dash_offset, selection_line_join, selection_line_width, size, visible

alpha, c, cmap, color, ec, ecolor, edgecolor, edgecolors, facecolors, linewidth, lw, marker, norm, s, visible, vmax, vmin

Examples#

TBD

This web page was generated from a Jupyter notebook and not all interactivity will work on this website.