0
나는 fig, plt의 가장 좋은 사용법을 아직도 이해하지 못한다. 도끼. in matplotlib plt를 사용해야합니까? 항상? 언제해야합니까? 사용 되나요?언제 ax를 사용해야합니까? matplotlib에?
나는 fig, plt의 가장 좋은 사용법을 아직도 이해하지 못한다. 도끼. in matplotlib plt를 사용해야합니까? 항상? 언제해야합니까? 사용 되나요?언제 ax를 사용해야합니까? matplotlib에?
fig
및 ax
은 object oriented interface의 일부이며 가능한 한 자주 사용되어야합니다.
도 대부분의 경우 이전 plt
인터페이스가 작동을 사용하여,하지만 당신은 만들고 조작 많은 수치를하거나 모든 수치를 추적하는 것은 매우 까다로운 될 수 축을 때
plt.figure()
plt.plot(...) # this implicitly modifies the axis created beforehand
plt.xlim([0, 10]) # this implicitly modifies the axis created beforehand
plt.show()
비교
에fig, ax = plt.subplots(1, 1)
ax.plot(...) # this explicitly modifies the axis created beforehand
ax.set_xlim([0, 10]) # this explicitly modifies the axis created beforehand
plt.show()