Points Plot with Large Data#
Points plot of a large and global earthquake dataset, displayed using Datashader (needs to be installed) under the hood to aggregate the data points pixel-wise (otherwise your browser tab might crash trying to display that many points!). This technique is ideal for efficiently visualizing and exploring large volumes of geospatial points. In this example we set tiles=True
to overlay the points on a web map tile. hvPlot doesn’t require GeoViews to be installed to display data expressed in lat/lon coordinates to Web Mercator (output projection imposed by the use of a web map tile).
import pandas as pd
df = pd.read_parquet('https://datasets.holoviz.org/earthquakes/v1/earthquakes-projected.parq')
print(f"This dataset contains {len(df):,} earthquakes.")
This dataset contains 2,116,537 earthquakes.
Note
Zooming and panning on the Bokeh plot below won’t trigger any update on the website. Run the code locally and interact with the plot to fully experience the effects of rasterize=True
.
import hvplot.pandas # noqa
df.hvplot.points(
x='longitude',
y='latitude',
rasterize=True,
cmap='fire',
cnorm='eq_hist',
dynspread=True,
title='Datashaded Earthquake Map (Bokeh)',
)
import hvplot.pandas # noqa
hvplot.extension('matplotlib')
df.hvplot.points(
x='longitude',
y='latitude',
datashade=True,
cmap='fire',
cnorm='eq_hist',
dynspread=True,
title='Datashaded Earthquake Map (Matplotlib)',
height=400,
data_aspect=1,
)
Note
tiles=True
is not supported with the Matplotlib backend.
See also
Resampling Options for more on using
rasterize
anddynspread
with large datasets.