首页 > 解决方案 > 在 matplotlib 的子图中使用 xscale 和 yscale

问题描述

我创建像

fig, (ax1, ax2) = plt.subplots(1, 2, sharex='col', sharey='row')

我和

ax1.plot(x, y)
ax2.plot(x, y)

现在我想将轴格式化为

ax1.xscale('log')
ax1.yscale('log')

但这导致

AttributeError: 'AxesSubplot' object has no attribute 'yscale'

如何格式化两个子图的轴?

标签: pythonmatplotlib

解决方案


推荐阅读