mirror of
https://github.com/Estom/notes.git
synced 2026-02-06 12:04:05 +08:00
877 B
877 B
弧度刻度
使用basic_units模型示例包中的弧度绘图。
此示例显示单元类如何确定刻度定位,格式设置和轴标记。
此示例需要basic_units.py
import matplotlib.pyplot as plt
import numpy as np
from basic_units import radians, degrees, cos
x = [val*radians for val in np.arange(0, 15, 0.01)]
fig, axs = plt.subplots(2)
axs[0].plot(x, cos(x), xunits=radians)
axs[1].plot(x, cos(x), xunits=degrees)
fig.tight_layout()
plt.show()
