我正在用以下代码绘制一个圆。我设置了Pyplot,以使图形占据整个屏幕。当它是较小的屏幕时,它将显示为圆形,但是全屏显示会使其变形。如何使圆图保持1:1比例? (即,我想使圆圈居中并保持相同,黑色背景填充在屏幕的其余部分。)
谢谢!
#Necessary imports
import matplotlib as plt
plt.use('TkAgg')
import matplotlib.pyplot as plt
#Initialize/define stuff
circle = plt.Circle((0.5, 0.5), 0.2, color='white')
fig, ax = plt.subplots() # note we must use plt.subplots, not plt.subplot
plt.axis('off')
figManager = plt.get_current_fig_manager()
figManager.full_screen_toggle()
#Display
ax.add_artist(circle)
fig.set_facecolor("black")
plt.show()