I already know how to set the bin size for a 1D histogram after looking at this answer,but I don't know how to do this for a 2D histogram. I have referred to both the Numpy and Matplotlib pages for the 2D histograms, but all my attempts to adjust the bin size did not work/run.I want my bins to have a length of 20 and a width of 2.
Example code:
import numpy as np
import matplotlib.pyplot as plt
import math
dataX = np.random.uniform(-50,50,100)
dataY = np.random.uniform(-50,50,100)
binWidth = 2.0
binLength = 20.0
xMin = min(dataX)
xMax = max(dataX)
yMin = min(dataY)
yMax = max(dataY)
#this and all other similar attempts that I have tried did not run
np.histogram2d(dataX, dataY, bins = np.arange((xMin,xMax + binWidth),(yMin,yMin +binLength),(binWidth,binLength)))
Looking forward to your hints/help/advice.