matplotlib
하는 일
이 스킬은 Python의 matplotlib 라이브러리로 세부적인 차트를 만드는 방법을 에이전트에게 가르칩니다. 논문용 그림을 포함해 그림이 어떻게 보일지 완전히 통제해야 하는 사람을 위한 스킬입니다.
사용하는 경우
- ✓Python에서 세밀한 스타일이 있는 차트나 그래프가 필요할 때.
- ✓여러 패널로 된 과학 그림을 PDF 또는 SVG로 내보내야 할 때.
- ✓Python으로 3D 또는 애니메이션 그래프를 만들고 싶을 때.
스킬 링크
https://github.com/zLanqing/codex-claude-academic-skills/blob/main/scientific-toolkit-skill/references/scientific-skills/matplotlib/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 측정 데이터를 축 이름이 있는 Python 그래프로 그리고, 논문용으로 PDF로 내보내 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 matplotlib의 Figure와 Axes 객체로 차트를 만들고, 색, 라벨, 범례를 조정한 뒤 선택한 형식으로 저장합니다. 빠른 통계나 대화형 그래프는 다른 라이브러리를 안내합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Matplotlib
Overview
Matplotlib is Python's foundational visualization library for creating static, animated, and interactive plots. This skill provides guidance on using matplotlib effectively, covering both the pyplot interface (MATLAB-style) and the object-oriented API (Figure/Axes), along with best practices for creating publication-quality visualizations.
When to Use This Skill
This skill should be used when:
- Creating any type of plot or chart (line, scatter, bar, histogram, heatmap, contour, etc.)
- Generating scientific or statistical visualizations
- Customizing plot appearance (colors, styles, labels, legends)
- Creating multi-panel figures with subplots
- Exporting visualizations to various formats (PNG, PDF, SVG, etc.)
- Building interactive plots or animations
- Working with 3D visualizations
- Integrating plots into Jupyter notebooks or GUI applications
Core Concepts
The Matplotlib Hierarchy
Matplotlib uses a hierarchical structure of objects:
- Figure - The top-level container for all plot elements
- Axes - The actual plotting area where data is displayed (one Figure can contain multiple Axes)
- Artist - Everything visible on the figure (lines, text, ticks, etc.)
- Axis - The number line objects (x-axis, y-axis) that handle ticks and labels
Two Interfaces
1. pyplot Interface (Implicit, MATLAB-style)
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.show()
- Convenient for quick, simple plots
- Maintains state automatically
- Good for interactive work and simple scripts
2. Object-Oriented Interface (Explicit)
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1, 2, 3, 4])
ax.set_ylabel('some numbers')
plt.show()
- Recommended for most use cases
- More explicit control over figure and axes
- Better for complex figures with multiple subplots
- Easier to maintain and debug
Common Workflows
1. Basic Plot Creation
Single plot workflow:
import matplotlib.pyplot as plt
import numpy as np
# Create figure and axes (OO interface - RECOMMENDED)
fig, ax = plt.subplots(figsize=(10, 6))
# Generate and plot data
x = np.linspace(0, 2*np.pi, 100)
ax.plot(x, np.sin(x), label='sin(x)')
ax.plot(x, np.cos(x), label='cos(x)')
# Customize
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_title('Trigonometric Functions')
ax.legend()
ax.grid(True, alpha=0.3)
# Save and/or display
plt.savefig('plot.png', dpi=300, bbox_inches='tight')
plt.show()
2. Multiple Subplots
Creating subplot layouts:
# Method 1: Regular grid
fig, axes = plt.subplots(2, 2, figsize=(12, 10))
axes[0, 0].plot(x, y1)
axes[0, 1].scatter(x, y2)
axes[1, 0].bar(categories, values)
axes[1, 1].hist(data, bins=30)
# Method 2: Mosaic layout (more flexible)
fig, axes = plt.subplot_mosaic([['left', 'right_top'],
['left', 'right_bottom']],
figsize=(10, 8))
axes['left'].plot(x, y)
axes['right_top'].scatter(x, y)
axes['right_bottom'].hist(data)
# Method 3: GridSpec (maximum control)
from matplotlib.gridspec import GridSpec
fig = plt.figure(figsize=(12, 8))
gs = GridSpec(3, 3, figure=fig)
ax1 = fig.add_subplot(gs[0, :]) # Top row, all columns
ax2 = fig.add_subplot(gs[1:, 0]) # Bottom two rows, first column
ax3 = fig.add_subplot(gs[1:, 1:]) # Bottom two rows, last two columns
3. Plot Types and Use Cases
Line plots - Time series, continuous data, trends
ax.plot(x, y, linewidth=2, linestyle='--', marker='o', color='blue')
Scatter plots - Relationships between variables, correlations
ax.scatter(x, y, s=sizes, c=colors, alpha=0.6, cmap='viridis')
Bar charts - Categorical comparisons
ax.bar(categories, values, color='steelblue', edgecolor='black')
# For horizontal bars:
ax.barh(categories, values)
Histograms - Distributions
ax.hist(data, bins=30, edgecolor='black', alpha=0.7)
Heatmaps - Matrix data, correlations
im = ax.imshow(matrix, cmap='coolwarm', aspect='auto')
plt.colorbar(im, ax=ax)
Contour plots - 3D data on 2D plane
contour = ax.contour(X, Y, Z, levels=10)
ax.clabel(contour, inline=True, fontsize=8)
Box plots - Statistical distributions
ax.boxplot([data1, data2, data3], labels=['A', 'B', 'C'])
Violin plots - Distribution densities
ax.violinplot([data1, data2, da
자주 묻는 질문
어떤 파일 형식으로 내보낼 수 있나요?
matplotlib는 출판용으로 PNG, PDF, SVG로 내보낼 수 있다고 스킬이 설명합니다.
빠른 통계 차트에도 가장 좋은 선택인가요?
아니요. 스킬은 빠른 통계 그래프에는 seaborn을 제안합니다.
3D 그래프도 만들 수 있나요?
네. 스킬은 3D 시각화를 다룬다고 설명합니다.
상세 정보
작성자의 원본 설명
Low-level plotting library for full customization. Use when you need fine-grained control over every plot element, creating novel plot types, or integrating with specific scientific workflows. Export to PNG/PDF/SVG for publication. For quick statistical plots use seaborn; for interactive plots use plotly; for publication-ready multi-panel figures with journal styling, use scientific-visualization.
인기도
- GitHub 스타
- 5.6k
- 순위
- #14768
- 라이선스
- MIT
- 업데이트
- 2026. 5. 14.
댓글
- …
이 저장소의 다른 스킬
office-academic-skill
5.6k연구 논문을 Word 보고서로 바꾸고 편집 가능한 중국어 중심 학술 PowerPoint 슬라이드를 만들며, 발표자 노트와 레이아웃 검사를 포함하도록 에이전트를 돕습니다.
research-writing-skill
5.6k연구 논문의 절, 초록, 심사자 답변을 작성하고 수정하며 다듬도록 에이전트를 돕습니다. 수식, 제목, 인용은 주어진 그대로 유지합니다.
scientific-toolkit-skill
5.6k신호 및 이미지 처리, 통계, 시뮬레이션, 출판용 그림을 위한 MATLAB 또는 Python 과학 코드를 작성하고 디버그하도록 에이전트를 돕습니다.
matlab
5.6k에이전트가 행렬 연산, 신호 및 이미지 처리, 미분방정식, 최적화, 그래프를 위한 MATLAB과 GNU Octave 스크립트를 작성하고 디버그하도록 돕습니다.
비슷한 스킬
gitcrawl
394k에이전트가 저장된 GitHub 이슈와 풀 리퀘스트 보관본을 검색하고, 중복 항목을 묶고, GitHub에서 현재 상태를 확인하도록 돕습니다.
slacrawl
394k에이전트가 로컬 Slack 보관본에서 메시지를 검색하고 개수를 세며, 보관본이 얼마나 최신인지 확인하고 필요할 때 새로 고치도록 돕습니다.
goplaces
394k에이전트가 Google Places로 장소를 검색하고, 세부 정보와 리뷰를 가져오고, 장소 이름을 확인하며, 스크립트용 JSON을 출력하도록 돕습니다.