How to remove frame from matplotlib (pyplot.figure vs matplotlib.figure ) (frameon=False Problematic in matplotlib)

后端 未结 11 2134
猫巷女王i
猫巷女王i 2020-11-27 09:53

To remove frame in figure, I write

frameon=False

works perfect with pyplot.figure, but with matplotlib.Figure it

11条回答
  •  情深已故
    2020-11-27 10:24

    Problem

    I had a similar problem using axes. The class parameter is frameon but the kwarg is frame_on. axes_api
    >>> plt.gca().set(frameon=False)
    AttributeError: Unknown property frameon

    Solution

    frame_on

    Example

    data = range(100)
    import matplotlib.pyplot as plt
    fig, ax = plt.subplots()
    ax.plot(data)
    #ax.set(frameon=False)  # Old
    ax.set(frame_on=False)  # New
    plt.show()
    

提交回复
热议问题