Matplotlib figure facecolor (background color)

前端 未结 4 709
無奈伤痛
無奈伤痛 2020-11-27 13:05

Can someone please explain why the code below does not work when setting the facecolor of the figure?

import matplotlib.pyplot as plt

# create figure instan         


        
4条回答
  •  无人及你
    2020-11-27 14:00

    I had to use the transparent keyword to get the color I chose with my initial

    fig=figure(facecolor='black')
    

    like this:

    savefig('figname.png', facecolor=fig.get_facecolor(), transparent=True)
    

提交回复
热议问题