且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

matplotlib子图的通用xlabel/ylabel

更新时间:2023-11-21 14:51:22

这看起来像您真正想要的.它将此答案的相同方法应用于您的特定情况:

This looks like what you actually want. It applies the same approach of this answer to your specific case:

import matplotlib.pyplot as plt

fig, ax = plt.subplots(nrows=3, ncols=3, sharex=True, sharey=True, figsize=(6, 6))

fig.text(0.5, 0.04, 'common X', ha='center')
fig.text(0.04, 0.5, 'common Y', va='center', rotation='vertical')