Skip to content

Instantly share code, notes, and snippets.

@Hazza4569
Created October 29, 2019 16:05
Show Gist options
  • Save Hazza4569/a49c1446e25ac2653d90395ab5646ee2 to your computer and use it in GitHub Desktop.
Save Hazza4569/a49c1446e25ac2653d90395ab5646ee2 to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
nbins = 25
delr=[0, 10]; delv = [0,10]
# np.meshgrid might be better here instead of this x,y stuff
rngex = np.linspace(min(delr),max(delr),nbins+1)
rngey = np.linspace(min(delv),max(delv),nbins+1)
x, y = np.meshgrid(rngex[:-1],rngey[:-1])
x = x.flatten()
y = y.flatten()
print(f"{x}\n{y}")
plt.hist2d(x,y,bins=[rngex,rngey])
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment