Scatter with Color and Size Encoding#

A scatter plot that encodes four variables: x-position, y-position, color, and size.

import hvplot.pandas  # noqa

df = hvplot.sampledata.earthquakes('pandas')

df.hvplot.scatter(
    x='lon',
    y='lat',
    color='mag',
    size='depth',
    cmap='plasma_r',
    alpha=0.7,
    clabel='Magnitude',
    title='Earthquakes by magnitude and depth (Bokeh)'
)
import hvplot.pandas  # noqa
hvplot.extension('matplotlib')

df = hvplot.sampledata.earthquakes('pandas')

df.hvplot.scatter(
    x='lon',
    y='lat',
    color='mag',
    size='depth',
    cmap='plasma_r',
    alpha=0.7,
    clabel='Magnitude',
    title='Earthquakes by magnitude and depth (Matplotlib)'
)
This web page was generated from a Jupyter notebook and not all interactivity will work on this website.