I would like to draw a round pie in a rectangle figure. At the moment I’m using something like:
fig = plt.figure(figsize=figsize, dpi=inch)
# plot actually
ax = fig.add_subplot(1, 1, 1)
ax.pie(value_list, labels=labels_list, **kwargs)
plt.savefig(plt_pathname)
plt.close()
If the figsize is not square ( eg. [4, 4]) then the resulting figure will be stretched, ellipsoid.
Can I overcome this issue?
Just use
ax.set_aspect(1)orax.axis('equal'). (Orplt.axis('equal'))ax.axis('equal')will also set the x and y limits to be the same, as well as setting the aspect of the plot to 1. In your case, that’s probably the best option.