数据可视化matplotlib.pyplot 模块

2018-01-08  本文已影响164人  Oppenheim

import matplotlib.pyplot as plt

x_values,y_values=。     一个array或者是series

plt.plot(x_values,y_values,c=color,label=数据匹配)将数据加入坐标中

plt.legend(loc="upper left")显示颜色图例

plt.show(). 显示图像

plt.xticks(rotation=90). 将x的标度值顺时针旋转90度,其他度数和y 的类推。

plt.xlabel("")          plt.ylabel("")         plt.title("")分别给x,y图像加题目。

fig=plt.figure(figsize=(width,height))

fig.add_sunplot(位置).  figure创建的是Axes类。但是图像的大小是默认的,于是在多幅图片时会现得很小,为了图像更大,可以利用figsize=(width,height)调整图片大小。

ax.tick_params(top='off',bottom='off',left='off',right='off')

for key spine in ax.spines.items():  spine.set_visible(False)

line width 设置线的宽度

  颜色的设置是一个元组,运用RGB的颜色体系

ax.axhline 添加参考线

上一篇 下一篇

猜你喜欢

热点阅读