Removing frame while keeping axes in pyplot subplots

后端 未结 3 1559
温柔的废话
温柔的废话 2021-02-01 17:39

I am creating a figure with 3 subplots, and was wondering if there is any way of removing the frame around them, while keeping the axes in place?

3条回答
  •  天命终不由人
    2021-02-01 18:06

    You can achieve something like this with the axis('off') method of an axis handle. Is this the kind of thing you are after? (example code below the figure).

    subplots without axes shown

    fig, ax = plt.subplots(7,1)
    
    t = np.arange(0, 1, 0.01)
    
    for i, a in enumerate(ax):
        a.plot(t, np.sin((i+1)*2*np.pi*t))
        a.axis('off')
    
    plt.show()
    

提交回复
热议问题