Hexbin Plot of Earthquake Locations#
A hexbin plot showing the spatial distribution of earthquakes by longitude and latitude. Hexagonal bins count how many events occurred in each region.
import hvplot.pandas # noqa
df = hvplot.sampledata.earthquakes("pandas")
df.hvplot.hexbin(
x='lon',
y='lat',
gridsize=30,
data_aspect=1,
cmap='viridis_r',
title='Earthquake Density by Location (Bokeh)',
xlabel='Longitude',
ylabel='Latitude',
)
import hvplot.pandas # noqa
hvplot.extension('matplotlib')
df = hvplot.sampledata.earthquakes("pandas")
df.hvplot.hexbin(
x='lon',
y='lat',
gridsize=30,
data_aspect=1,
width=600,
cmap='viridis_r',
title='Earthquake Density by Location (Matplotlib)',
xlabel='Longitude',
ylabel='Latitude',
)
See also
This web page was generated from a Jupyter notebook and not all
interactivity will work on this website.