Skip to content

Instantly share code, notes, and snippets.

@srdg
Created June 8, 2021 15:32
Show Gist options
  • Save srdg/f258b1b937736c8374f70ac21ba14308 to your computer and use it in GitHub Desktop.
Save srdg/f258b1b937736c8374f70ac21ba14308 to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
c = plt.hist(np.random.rand(500), bins=30, color='yellow', edgecolor='black')
plt.figure()
x, y = sorted([round(i,2) for i in c[1][:-1]] ), sorted(c[0])
d = {}
for i in range(len(x)):
d[str(x[i])] = y[i]
plt.xticks([])
plt.yticks([])
_=plt.bar(d.keys(), d.values(), color='yellow', edgecolor='black')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment