각 서브플롯에 대해 축 텍스트를 회전하기 위해 인수에서 회전이 있는 텍스트를 사용할 수 있습니다.
단계
-
새 그림을 만들거나 기존 그림을 활성화하세요.
-
'~.axes.Axes' 추가 add_subplot()을 사용하여 서브플롯 배열의 일부로 그림에 방법.
-
subplots_adjust()를 사용하여 서브플롯 레이아웃 매개변수를 조정합니다. 방법.
-
suptitle()을 사용하여 그림에 중앙에 제목을 추가합니다. 방법.
-
축의 제목을 설정합니다.
-
플롯의 x 및 y 레이블을 설정합니다.
-
일부 좌표점으로 축을 만듭니다.
-
글꼴 크기, 글꼴 두께와 같은 인수를 사용하여 그림에 텍스트 추가 회전 추가 .
-
단일 점을 표시하고 텍스트와 화살촉으로 해당 점에 주석을 답니다.
-
그림을 표시하려면 show()를 사용하세요. 방법.
예시
from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
fig = plt.figure()
ax = fig.add_subplot()
fig.subplots_adjust(top=0.85)
fig.suptitle('bold figure suptitle', fontsize=14, fontweight='bold')
ax.set_title('axes title')
ax.set_xlabel('xlabel')
ax.set_ylabel('ylabel')
ax.axis([0, 10, 0, 10])
ax.text(3, 8, 'boxed italics text in data coords', style='italic',
bbox={'facecolor': 'red', 'alpha': 0.5, 'pad': 10})
ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=15)
ax.text(3, 2, 'unicode: Institut für Festkörperphysik')
ax.text(0.95, 0.01, 'colored text in axes coords',
verticalalignment='bottom', horizontalalignment='right',
transform=ax.transAxes,
color='green', fontsize=15)
ax.plot([2], [1], 'o')
ax.annotate('annotate', xy=(2, 1), xytext=(3, 4),
arrowprops=dict(facecolor='black', shrink=0.05))
plt.show() 출력
