Python histogram

1, Example 1

import numpy as np
import matplotlib.pyplot as plt 

# Generates data np.random.randint = V1 (0, 13 is,. 7 ) plt.bar (List (Range (. 7 )), V1) plt.show ()

Graph

2, pandas drawing

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt # 生成数据 y = np.random.randint(0, 13, 7) y = pd.DataFrame(y, columns=['v']) y.plot(kind='bar', color='k') plt.show()
Copy the code

Graph

 

 

。。。

Guess you like

Origin www.cnblogs.com/shanger/p/12175574.html