[ Web Proxy ]
URL:
Viewing: https://matplotlib.org/stable/api/_as_gen/../../devel/MEP/../../plot_types/3D/../stats/hexbin.html [Back]  [Original]

hexbin(x, y, C) — Matplotlib 3.11.2 documentation
Back to top
Search the docs ...:

hexbin(x, y, C)#

Make a 2D hexagonal binning plot of points x, y.

See hexbin.

hexbin [hexbin]
import matplotlib.pyplot as plt
import numpy as np

plt.style.use('_mpl-gallery-nogrid')

# make data: correlated + noise
np.random.seed(1)
x = np.random.randn(5000)
y = 1.2 * x + np.random.randn(5000) / 3

# plot:
fig, ax = plt.subplots()

ax.hexbin(x, y, gridsize=20)

ax.set(xlim=(-2, 2), ylim=(-3, 3))

plt.show()

Gallery generated by Sphinx-Gallery


Web Proxy Viewer  |  New URL  |  Original Page