每日总结
20220706
今天学习了python数据分析三大库中的matplotlib中的条形图,直方图和numpy库,numpy库的主要功能类似于matlab中的多为的列表矩阵。
from matplotlib import pyplot as plt
from matplotlib import font_manager
y_3 = [1,1,6,5,1,6,1,6,1,6,1,6,1,6,4,6,2,6,1,1,6,6,6,1,5,1,5,5,9,10,10]
x_3 = range(1, 32)
x_10 = range(51, 82)
plt.figure(figsize=(20, 8), dpi=80)
plt.scatter(x_3,y_3)
plt.scatter(x_10, y_3)
_x = list(x_3) + list(x_10)
plt.show()
from matplotlib import pyplot as plt
from matplotlib import font_manager
import matplotlib
matplotlib.rc("font",family='KaiTi')
a = ['你好世界','你的名字']
b = [10, 20]
plt.figure(figsize=(20, 8), dpi=80)
plt.bar(range(len(a)), b, width=0.3)
plt.xticks(range(len(a)), a, rotation=45)
plt.show()
print('-----------------')
from matplotlib import pyplot as plt
from matplotlib import font_manager
import matplotlib
matplotlib.rc("font",family='KaiTi')
a = ['你好世界','你的名字']
b = [10, 20]
plt.figure(figsize=(20, 8), dpi=80)
plt.barh(range(len(a)), b, height=0.3)
plt.yticks(range(len(a)), a, rotation=45)
plt.show()
print('-----------------')
import numpy as np
import random
x = np.array(range(10), dtype=bool)
# print(x)
# print(x.dtype)
# t = np.array(random.random for i in range(10))
t1 = np.arange(24).reshape((4,6))
print(t1, type(t1))
t2 = np.arange(25,49).reshape((4, 6))
print(t2)
print(t1*t2)
t3 = t1.reshape((2,12))
print(t3)
浙公网安备 33010602011771号