Skip to main content
Ctrl+K
Matplotlib 3.10.0.dev759+ge90952ffac 文档 - Home
  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Gitter
  • Discourse
  • GitHub
  • Twitter
  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Gitter
  • Discourse
  • GitHub
  • Twitter

Section Navigation

  • 线条、条形和标记
  • 图像、轮廓和场
  • 子图、轴和图形
    • 对齐标签和标题
    • 以编程方式控制子图调整
    • 坐标轴方框比例
    • 坐标轴演示
    • 使用边距和粘性边缘控制视图限制
    • Axes 属性
    • 坐标轴缩放效果
    • 绘制跨越一个轴的区域
    • 等轴长宽比
    • 轴标签位置
    • 断开的轴
    • 自定义图表子类
    • 使用约束布局调整轴的大小
    • 使用紧凑布局调整坐标轴大小
    • 同一Axes上的不同刻度
    • 不同单位中的图形尺寸
    • 图表标签:suptitle, supxlabel, supylabel
    • 相邻子图
    • 地理投影
    • 使用 subplots 和 GridSpec 组合两个子图
    • 用于多列/行子图布局的网格规格
    • 嵌套的网格规格
    • 倒置轴
    • 在 pyplot 中管理多个图形
    • 次要轴
    • 共享轴限制和视图
    • 共享轴
    • 图子图
    • 多个子图
    • 子图间距和边距
    • 使用 plt.subplots 创建多个子图
    • 不同尺度的图表
    • 缩放区域插入轴
  • 统计
  • 饼图和极坐标图
  • 文本、标签和注释
  • 颜色
  • 形状和集合
  • 样式表
  • 模块 - pyplot
  • 模块 - axes_grid1
  • 模块 - axisartist
  • 展示
  • 动画
  • 事件处理
  • 杂项
  • 3D 绘图
  • 比例尺
  • 专业图表
  • 书脊
  • Ticks
  • 单位
  • 在图形用户界面中嵌入 Matplotlib
  • 小部件
  • 用户演示
  • 示例
  • 子图、轴和图形
  • Axes 属性

备注

前往结尾 下载完整示例代码。

Axes 属性#

你可以控制轴刻度和网格属性

axes props
import matplotlib.pyplot as plt
import numpy as np

t = np.arange(0.0, 2.0, 0.01)
s = np.sin(2 * np.pi * t)

fig, ax = plt.subplots()
ax.plot(t, s)

ax.grid(True, linestyle='-.')
ax.tick_params(labelcolor='r', labelsize='medium', width=3)

plt.show()

下载 Jupyter 笔记本: axes_props.ipynb

下载 Python 源代码: axes_props.py

下载压缩包: axes_props.zip

由 Sphinx-Gallery 生成的图库

© Copyright 2002–2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012–2024 The Matplotlib development team.

由 Sphinx 8.0.2创建。

Built from v3.9.2-622-gb01462c9ac-dirty.

Built with the PyData Sphinx Theme 0.15.4.