如何查看matplotlib官方文档的API

如何查看matplotlib官方文档的API

以如下链接为例:(查找折线图线条设置的类型)的)https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.plot.html
1、参考手册
如何查看matplotlib官方文档的API_第1张图片
2、找到对应的库
如何查看matplotlib官方文档的API_第2张图片
3、可以左侧列表查询,也可以右侧直接翻找
如何查看matplotlib官方文档的API_第3张图片
4、折线图的线条设置,参数是marker,写在plt中
如何查看matplotlib官方文档的API_第4张图片
往下找,找到marker。

import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('qt4agg') # 加上避免报错
#指定默认字体
matplotlib.rcParams['font.sans-serif'] = ['SimHei']
matplotlib.rcParams['font.family']='sans-serif'
#解决负号'-'显示为方块的问题
matplotlib.rcParams['axes.unicode_minus'] = False
plt.plot([1,2,3,4,5],[1,4,9,16,25],marker='<')
# 设置标签,设置字体大小
plt.xlabel('xlabelx轴',fontsize=16)
plt.ylabel('ylabely轴',fontsize=16)

如何查看matplotlib官方文档的API_第5张图片
题外话:

如果想使用复合线条模式,直接写。

plt.plot([1,2,3,4,5],[1,4,9,16,25],'-.')
# 设置标签,设置字体大
plt.xlabel('xlabelx轴',fontsize=16)
plt.ylabel('ylabely轴',fontsize=16)

如何查看matplotlib官方文档的API_第6张图片

你可能感兴趣的:(数据分析,机器学习,深度学习)