Python 은 하위 그림 그리 기 및 하위 그림 눈금 변환 등 문 제 를 실현 합 니 다.
2.다음 과 같은 코드 를 그립 니 다.
accuracy_alexnet_clef = [78.05, 78.43, 78.65, 78.61, 78.69]
accuracy_resnet_clef = [84.56, 84.84, 85.07, 85.01, 85.13]
accuracy_alexnet_office10 = [87.30, 87.57, 87.78, 87.72, 87.50]
accuracy_resnet_office10 = [96.31, 96.35, 96.62, 96.43, 96.15]
orders = ['2', '3', '5', '10', '20']
names = ['alexnet', 'resnet']
#
f, ax = plt.subplots(2,1,figsize=(6, 8))
#
x = [i for i in range(len(orders))]
#
x1 = [i + 0.35 for i in range(len(orders))]
#
plt.subplots_adjust(wspace =0, hspace =0.4)
#
figure_1 = ax[0]
# x
figure_1.set_xticks([i+0.15 for i in x])
figure_1.set_xticklabels(orders)
# y
figure_1.set_ylim(bottom=77,top=86)
# ,x x ,accuracy_alexnet_clef y ,alpha ,width
# label
figure_1.bar(x, accuracy_alexnet_clef, alpha=0.7, width = 0.35, facecolor = '#4c72b0', label='Alexnet')
figure_1.bar(x1, accuracy_resnet_clef, alpha=0.7, width = 0.35, facecolor = '#dd8452', label='Resnet')
figure_1.set_ylabel('Accuracy%') # y
figure_1.set_xlabel('Order') # x
figure_1.set_title('Alexnet') #
figure_1.legend() #
#
figure_2 = ax[1]
figure_1.set_xticks([i+0.15 for i in x])
figure_1.set_xticklabels(orders)
figure_2.set_ylim(bottom=77,top=100)
figure_2.bar(x, accuracy_alexnet_office10,alpha=0.7,width = 0.35,facecolor = '#c44e52', label='Alexnet')
figure_2.bar(x1, accuracy_resnet_office10,alpha=0.7,width = 0.35,facecolor = '#5f9e6e', label='Alexnet')
# figure_2.bar(orders, accuracy_resnet_clef,alpha=0.7,width = 0.35,facecolor = '#dd8452')
figure_2.set_ylabel('Accuracy%')
figure_2.set_xlabel('Order')
figure_2.set_title('Resnet')
figure_2.legend()
f.suptitle('ImageCLEF_DA') #
plt.show()
추가:python 에서 subplot 가 하위 그림 을 그 릴 때 하위 그림 좌표 축 라벨 과 제목 이 겹 치 는 문 제 를 해결 합 니 다.1.문제 설명
python 의 matplotlib 의 subplot 를 사용 하여 하위 그림 을 그 릴 때 정보 가 서로 겹 치 는 상황 이 발생 합 니 다.
2.해결 방안
plt.show()앞 에 코드 plt.tight 추가layot()가 해결 할 수 있 습 니 다.
plt.subplot(211)
plt.figure(1)
plt.hist(x, 10)
plt.title("Histogram of sample points")
plt.subplot(212)
plt.plot(x,X.pdf(x))
plt.title("Probability Density Function(PDF)")
plt.tight_layout()
plt.show()
이상 은 개인 적 인 경험 이 므 로 여러분 에 게 참고 가 되 기 를 바 랍 니 다.여러분 들 도 저 희 를 많이 응원 해 주시 기 바 랍 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Python의 None과 NULL의 차이점 상세 정보그래서 대상 = 속성 + 방법 (사실 방법도 하나의 속성, 데이터 속성과 구별되는 호출 가능한 속성 같은 속성과 방법을 가진 대상을 클래스, 즉 Classl로 분류할 수 있다.클래스는 하나의 청사진과 같아서 하나의 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.