Task 2 科研绘图学习

第二章 绘制工具及其重要特征

2.1 Matplotlib

图形元素:

  • 画布 figure
  • 坐标图形 axes
  • 轴 axis
  • 刻度 tick

图层顺序:

  • 0: Images(AxesImage, FigureImage, BboxImage)
  • 1: Patch / PatchCollection
  • 2: Line2D / LineCollection
  • 3: Text
  • 4: Inset axes & Legend

轴对象:matplotlib中至少有两个(X, Y)

轴对象还可以控制轴比例(axis scale)、刻度位置(tick locator)和刻度格式(tick formatter)

  • 轴比例

image-20230822221251787

  • 刻度位置和刻度格式

image-20230822221300403

image-20230822221313306

坐标系
  • 直角坐标系(rectangular coordinate system)
  • 极坐标系(polar coordinate system)
    • 极坐标系往往体现数据的周期性,即它可以更好地展示数据的周期性变化,这就要求数据 较为完整且有明显的周期性特征。
  • 地理坐标系(geographic coordinate system)
    • 投影方式:
      • Aitoff 投影
      • Hammer 投影
      • Lambert 投影
      • Mollweide 投影

image-20230822221347883

多子图
  • subplot() 函数

image-20230822221524823

  • add_subplot()函数

image-20230822221552412

  • subplots()

subplots(nrows, ncols, sharex, sharey)

  • axes()
    • rect[left, bottom, width, height]

image-20230822221721506

  • subplot2grid() 函数

实现对不规则多子图的绘制

subplot2grid(shape, location, rowspan/colspan)

image-20230822221838043

  • gridspec.GridSpec() 函数

gridspec.GridSpec(nrows, ncols, figure, left, bottom, right, top)

image-20230822221936733

image-20230822221943214

  • subplot_mosaic() 函数

    subplot_mosaic(mosaic,…)

常见绘图类型:

image-20230822222025210

image-20230822222044603

结果保存

fig.savefig()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值