HexBin#

ax.hexbin is a 2D histogram plot, in which the bins are hexagons and the color represents the number of data points within each bin. Unlike Matplotlib, gridsize (by default 100) can be only a single int.

Note

Available with mpltern>=0.5.0

import numpy as np

import matplotlib.pyplot as plt
import mpltern

np.random.seed(19680801)
t, l, r = np.random.dirichlet(alpha=(2.0, 4.0, 8.0), size=100000).T
ax = plt.subplot(projection="ternary")

# If "edgecolors=face" (default), small hexagons look overlapping.
ax.hexbin(t, l, r, edgecolors="none")

plt.show()
hexbin
ax = plt.subplot(projection="ternary")

ax.hexbin(t, l, r, bins="log", edgecolors="none")

plt.show()
hexbin

Total running time of the script: (0 minutes 6.322 seconds)

Gallery generated by Sphinx-Gallery