Matplotlib막대 차트
GRAPHS 탭에서 차트를 렌더링합니다.
개요
이 스크립트는 matplotlib를 활용하여 언어 인기도를 비교하는 2D 미적 막대 차트를 렌더링합니다.
가장자리 척추, 그림 크기 및 16진수 색상의 형식을 동적으로 지정합니다.
코드 및 실행 출력
이는 브라우저 엔진 인라인을 통한 matplotlib 렌더링을 보여줍니다.
chart.py
에디터에서 사용해 보세요import matplotlib.pyplot as plt
import numpy as np
langs = ['Python', 'JavaScript', 'TypeScript', 'Rust', 'Go']
scores = [95, 88, 82, 78, 75]
colors = ['#0D9488', '#F59E0B', '#3B82F6', '#EF4444', '#8B5CF6']
fig, ax = plt.subplots(figsize=(8, 5))
bars = ax.bar(langs, scores, color=colors, edgecolor='none', width=0.6)
ax.set_title('Language Popularity Index 2025', fontsize=14, fontweight='bold', pad=15)
ax.set_ylabel('Score', fontsize=11)
ax.set_ylim(60, 100)
ax.spines[['top', 'right']].set_visible(False)
for bar, score in zip(bars, scores):
ax.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 0.5,
str(score), ha='center', va='bottom', fontweight='bold')
plt.tight_layout()
plt.show()터미널 출력
Rendered visualization in the Graphs tab...단계별 구현
- 데이터 시각화
- 과학적 분석
- 통계보고
자주 묻는 질문
그래프는 어디에 나타납니까?
PyRun은 matplotlib 렌더링 끝점을 자동으로 가로채서 전용 격리된 Graphs DOM 요소로 파이프합니다.