Answers for "Compute the 2d histogram of x and y."

0

Compute the 2d histogram of x and y.

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

xedges = [0, 1, 2, 3]
yedges = [0, 1, 2, 3, 4]
x = np.array([0, 0.1, 0.2, 1., 1.1, 2., 2.1])
y = np.array([0, 0.1, 0.2, 1., 1.1, 2., 3.3])

out = np.histogram2d(x, y, bins=(xedges, yedges))

plt.scatter(x, y)
plt.grid()
Posted by: Guest on June-02-2020

Code answers related to "Compute the 2d histogram of x and y."

Python Answers by Framework

Browse Popular Code Answers by Language