Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Quick example of masking 0-count portions of a 2D histogram
import numpy as np
import matplotlib.pyplot as plt
x, y = np.random.normal(0, 1, (2, 1000))
counts, ybins, xbins = np.histogram2d(y, x, bins=30)
counts =, 0)
fig, ax = plt.subplots()
ax.pcolormesh(xbins, ybins, counts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.