相关疑难解决方法(0)

在matplotlib中共享轴时显示刻度标签

我正在运行以下功能:

def plot_variance_analysis(indices, stat_frames, legend_labels, shape):
    x = np.linspace(1, 5, 500)
    fig, axes = plt.subplots(shape[0], shape[1], sharex=True sharey=True)
    questions_and_axes = zip(indices, axes.ravel())
    frames_and_labels = zip(stat_frames, legend_labels)
    for qa in questions_and_axes:
        q = qa[0]
        ax = qa[1]
        for fl in frames_and_labels:
            frame = fl[0]
            label = fl[1]
            ax.plot(x, stats.norm.pdf(x, frame['mean'][q], frame['std'][q]), label=label)
            ax.set_xlabel(q)
            ax.legend(loc='best')
    plt.xticks([1,2,3,4,5])
    return fig, axes
Run Code Online (Sandbox Code Playgroud)

以下是我自己的一些示例数据:

在此输入图像描述

我正在尝试维持轴之间的共享状态,但同时在所有子图(包括前两个)上显示x轴的刻度标签.我找不到任何方法在文档中关闭它.有什么建议?或者我应该逐轴设置x刻度标签?

我正在运行matplotlib 1.4.0,如果这很重要的话.

python matplotlib

15
推荐指数
3
解决办法
7104
查看次数

标签 统计

matplotlib ×1

python ×1