【发布时间】:2019-11-01 14:32:19
【问题描述】:
我有几个子图,想通过 ax.tick_params 调整轴刻度设置。一切正常,但是没有显示 minor 刻度。这是一个代码示例
import matplotlib.pyplot as plt
x = np.linspace(0,1,100)
y = x*x
f, (ax1,ax2) = plt.subplots(2, 1)
ax1.tick_params(axis="both", direction="in", which="both", right=False, top=True)
ax2.tick_params(axis="both", direction="in", which="both", right=True, top=False)
ax1.plot(x,y)
ax2.plot(x,-y)
plt.show()
我认为 which=both 会给我小勾。但是我需要添加一个额外的
plt.minorticks_on()
这使得它们在 ax2 中可见但仅。
我该如何解决这个问题?
【问题讨论】:
标签: python matplotlib plot subplot