Ich versuche, eine Figur zu formatieren, die ich mache. Ich habe versucht, das Seitenverhältnis einzustellen, aber wenn ich den Seitenverhältnisaufruf einschließe oder ax.set_aspect() verwende, lande ich mit einer abgeflachten Figur.Probleme mit der Einstellung des Seitenverhältnisses in Matplotlib, Python 3.6, Abflachung Figur
fig, ax = plt.subplots(1, 1)
plt.rcParams["font.family"] = 'Calibri'
ax.set(xlim=[415, 700], ylim=[0,1.01], aspect=1)
ax.set_xlabel('Wavelength (nm)')
ax.set_ylabel('Normalized Reflectance (a.u.)')
_ = ax.plot(x_lambda[0], y_refl_norm[0], marker='', linestyle='-', color='m')
_ = ax.plot(x_lambda[1], y_refl_norm[1], marker='', linestyle='-', color='b')
_ = ax.plot(x_lambda[2], y_refl_norm[2], marker='', linestyle='-', color='c')
_ = ax.plot(x_lambda[3], y_refl_norm[3], marker='', linestyle='-', color='g')
_ = ax.plot(x_lambda[4], y_refl_norm[4], marker='', linestyle='-', color='y')
_ = ax.plot(x_lambda[5], y_refl_norm[5], marker='', linestyle='-',
color='orange')
_ = ax.plot(x_lambda[6], y_refl_norm[6], marker='', linestyle='-', color='r')
ax.legend(('30 degrees', '35 degrees', '40 degrees', '45 degrees', '50
degrees', '55 degrees', '60 degrees'), loc='lower left', fontsize='x-small',
frameon='True', facecolor='navajowhite', framealpha=0.95)
Vielen Dank! Ich glaube, ich habe wirklich missverstanden, was "aspect = 1" bedeutet, aber das macht viel mehr Sinn, dass es eher der Aspekt der Daten als das Seitenverhältnis der gedruckten Figur ist. – yixingking
Fehler Seitenverhältnis der Achsen * – yixingking
Es ist ziemlich einfach, das Seitenverhältnis der Figur einzustellen, siehe z.B. https://stackoverflow.com/questions/332289/how-do-you-change-the-size-of-figures-drawn-with-matplotlib – Bart