数据分析DV04

11 篇文章 0 订阅
2 篇文章 0 订阅

matplotlib

import matplotlib.pyplot as plt

subplot绘图区域

plt.subplot(nrows,ncols,plot_number)
plot_number从左上角开始,起始为1

plt.plot(x,y,format_string,**kwargs)

  • x:x轴数据,列表或数组。可选
  • y:y轴数据,列表或数组
  • format_string:控制曲线的格式字符串,可选。颜色、风格字符(虚实)、标记字符(△)ex:‘go-’
  • **kwargs:第二组或更多的(x,y,format_string) color,linestyle,marker,makerfacecolor

显示中文

matplotlib.rcParams[‘font.family’]=‘SimHei’(改变的是全局字体)
在这里插入图片描述

方法二(推荐)
在有中文输出的地方,增加一个属性fontproperties

plt.xlabel('横轴:时间',fontproperties='SimHei',fontsize=20)

文本显示

函数说明
plt.xlabel()
plt.ylabel()
plt.title()
plt.text在任意位置增加文本
plt.annotate(s,xy=arrow_crd,xytext_crd,arrowprops=dict)在图形中增加带箭头的注释

子绘图区域

plt.subplot2grid(Gridspec,CurSpec,colspan=1,rowspan=1)
设定网格,选中网格,确定选中行列区域数量,编号从0开始

import matplotlib.gridspec as gridspec
gs = gridspec.Gridspec(3,3)

ax1=plt.subplot(gs[0,:])

基础图标函数

函数说明
plt.plot(x,y,fmt,…)坐标图
plt.boxplot(data,notch,position)箱型图
plt.bar(left,height,width,bottom)条形图
plt.barh(width,bottom,left,height)横向条形图
plt.polar(theta,r)极坐标图
plt.pie(data,explode)饼图
plt.scatter(x,y)散点图
plt.hist(x,bins,normed)直方图

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

引力波绘制

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值