Answers for "numpy plot histogram"

0

plot histogram python

import matplotlib.pyplot as plt	
  	data = [1.7,1.8,2.0,2.2,2.2,2.3,2.4,2.5,2.5,2.5,2.6,2.6,2.8,
    2.9,3.0,3.1,3.1,3.2,3.3,3.5,3.6,3.7,4.1,4.1,4.2,4.3]
  	plt.hist(data)
    plt.title('Histogram of Data')
    plt.xlabel('data')
    plt.ylabel('count')
Posted by: Guest on May-31-2021
0

numpy histogram 0 to 100 percent

kwargs2 = dict(histtype='step')
fig, ax1=plt.subplots(1,1,sharey=True, facecolor='w',figsize=(8,6))

counts_zi, bins_zi = np.histogram(np.array(dt_mu_zi)*60)
ax1.hist(bins_zi[:-1], bins_zi, weights=100*counts_zi/counts_zi.sum(),color='red', **kwargs2)

x0, x1 = ax1.get_xlim()
ax1.set_xlim([x0,x0+1*(x1-x0)])

ax1.set_ylabel('Frequency',fontsize=12)
ax1.set_xlabel('Delta time (minutes)',fontsize=12)
plt.xticks([-180,-150,-120,-90,-60,-30,0,30,60,90,120,150,180])
Posted by: Guest on September-17-2020

Python Answers by Framework

Browse Popular Code Answers by Language