Matplotlib常用API

导入库

improt matplotlib.pyplot  as plt
方法用法
plt.title()
(图的标题)
plt.title(“Matplotlib demo”)
plt.xlabel()
(X轴描述)
plt.xlabel(“x axis caption”)
plt.ylabel()
(Y轴描述)
plt.ylabel(“y axis caption”)
plt.plot()
(画图)
plt.plot(x,y)
plt.show()
显示
plt.show()
plt.subplot()
(子图绘制)
plt.subplot(2, 1, 1) 21 第一个图
plt.subplot(2, 1, 2) 2
1 第二个图
plt.bar(x, y, align = ‘center’)
(条状图)
plt.figure()
存放实例代码生成的图片
figure(figsize=(8,6), dpi=80)
创建一个 8 * 6 点(point)的图,并设置分辨率为 80
xlim
横轴的上下限
xlim(-4.0,4.0)
ylim
纵轴的上下限
ylim(-1.0,1.0)
legend())<图例位置>legend(loc=‘upper left’)
scatter
scatter(X,Y)
contourf
等高线
contourf(X, Y, f(X,Y), 8, alpha=.75, cmap=‘jet’)

中文支持

import matplotlib as mpl
# matplotlib 中文 负号的支持
mpl.rcParams["font.family"] = "SimHei"
mpl.rcParams["axes.unicode_minus"] = False
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值