본문으로 건너뛰기
cccskills
무료GitHub에 공개

matplotlib-best-practices

Best practices for Matplotlib data visualization, plotting, and creating publication-quality figures in Python

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.0 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Matplotlib Best Practices

Expert guidelines for Matplotlib development, focusing on data visualization, plotting, and creating publication-quality figures.

Code Style and Structure

  • Write concise, technical Python code with accurate Matplotlib examples
  • Create informative and visually appealing plots with proper labels, titles, and legends
  • Use the object-oriented API for complex figures, pyplot for quick plots
  • Follow PEP 8 style guidelines
  • Consider color-blindness accessibility in all visualizations

API Approaches

Object-Oriented Interface (Recommended)

  • Use fig, ax = plt.subplots() for explicit control
  • Preferred for complex figures and production code
  • Methods are called on axes objects: ax.plot(), ax.set_xlabel()
  • Enables multiple subplots and fine-grained customization

Pyplot Interface

  • Use plt.plot(), plt.xlabel() for quick, interactive plots
  • Suitable for Jupyter notebooks and exploration
  • Use %matplotlib inline in Jupyter notebooks

Creating Effective Visualizations

Plot Types and Selection

  • Line plots (ax.plot()) for continuous data and trends
  • Scatter plots (ax.scatter()) for relationship between variables
  • Bar plots (ax.bar(), ax.barh()) for categorical comparisons
  • Histograms (ax.hist()) for distributions
  • Box plots (ax.boxplot()) for statistical summaries
  • Heatmaps (ax.imshow(), ax.pcolormesh()) for 2D data

Labels and Annotations

  • Always include axis labels with units
  • Use descriptive titles that convey the message
  • Add legends when multiple series are present
  • Use annotations (ax.annotate()) to highlight key points
  • Include data source attribution when appropriate

Color and Style

  • Use colorblind-friendly palettes (e.g., 'viridis', 'plasma', 'cividis')
  • Avoid red-green combinations for accessibility
  • Use consistent colors for the same categories across figures
  • Use appropriate colormaps for data type:
    • Sequential: 'viridis', 'plasma' for continuous data
    • Diverging: 'RdBu', 'coolwarm' for data with meaningful center
    • Qualitative: 'Set1', 'tab10' for categorical data

Figure Layout and Composition

Subplots

  • Use plt.subplots(nrows, ncols) for grid layouts
  • Use gridspec for complex, non-uniform layouts
  • Share axes with sharex=True, sharey=True for comparison
  • Use constrained_layout=True or tight_layout() to prevent overlap

Figure Size and Resolution

  • Set figure size explicitly: figsize=(width, height) in inches
  • Use appropriate DPI for intended output (72 screen, 300+ print)
  • Standard sizes: (10, 6) for presentations, (8, 6) for papers

Customization

Style Sheets

  • Use built-in styles: plt.style.use('seaborn-v0_8'), 'ggplot'
  • Create custom style files for consistent branding
  • Combine styles: plt.style.use(['seaborn-v0_8', 'custom.mplstyle'])

Text and Fonts

  • Use LaTeX for mathematical notation: r'$\alpha = \frac{1}{2}$'
  • Set font family for consistency
  • Adjust font sizes for readability at intended display size

Saving and Exporting

File Formats

  • Use vector formats (PDF, SVG, EPS) for publications
  • Use PNG for web and presentations with transparency
  • Use JPEG only for photographs (lossy compression)

Export Settings

  • Use bbox_inches='tight' to remove excess whitespace
  • Set facecolor for background color
  • Specify dpi appropriate for use case
  • Use transparent=True for overlays

Performance Optimization

  • Use rasterized=True for scatter plots with many points
  • Consider downsampling data for visualization
  • Close figures with plt.close() after saving
  • Use plt.close('all') in loops creating many figures

Key Conventions

  • Import as import matplotlib.pyplot as plt
  • Use object-oriented API for production code
  • Always label axes and include units
  • Test visualizations at intended display size
  • Consider accessibility in color choices

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

12-agent academic paper writing pipeline. 10 modes (full/plan/outline/revision/revision-coach/abstract/lit-review/format-convert/citation-check/disclosure). 6 paper types, 5 citation formats, bilingual abstracts, LaTeX/DOCX-via-Pandoc/PDF output. Style Calibration + Writing Quality Check + Anti-Patterns with IRON RULE markers. Triggers: write paper, academic paper, guide my paper, parse reviews, AI disclosure, 寫論文, 學術論文, 引導我寫論文, 審查意見.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bouclem/skills72026년 5월 31일 업데이트

Multi-perspective academic paper review with dynamic reviewer personas. Simulates 5 independent reviewers (EIC + 3 peer reviewers + Devil's Advocate) with field-specific expertise. Supports full review, re-review (verification), quick assessment, methodology focus, Socratic guided, and calibration modes. Triggers on: review paper, peer review, manuscript review, referee report, review my paper, critique paper, simulate review, editorial review, calibrate reviewer, reviewer calibration, measure reviewer accuracy.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bouclem/skills72026년 5월 31일 업데이트

Orchestrator for the full academic research pipeline: research -> write -> integrity check -> review -> revise -> re-review -> re-revise -> final integrity check -> finalize. Coordinates deep-research, academic-paper, and academic-paper-reviewer into a seamless 10-stage workflow with mandatory integrity verification, two-stage peer review, and reproducible quality gates. Triggers on: academic pipeline, research to paper, full paper workflow, paper pipeline, end-to-end paper, research-to-publication, complete paper workflow.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bouclem/skills72026년 5월 31일 업데이트

Create, iterate, and scale paid ad creative for Google Ads, Meta, LinkedIn, TikTok, and similar platforms. Use when generating headlines, descriptions, primary text, or large sets of ad variations for testing and performance optimization.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bouclem/skills72026년 5월 31일 업데이트

This skill should be used when the user asks to "implement LLM-as-judge", "compare model outputs", "create evaluation rubrics", "mitigate evaluation bias", or mentions direct scoring, pairwise comparison, position bias, evaluation pipelines, or automated quality assessment.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bouclem/skills72026년 5월 31일 업데이트

AI agent development workflow for building autonomous agents, multi-agent systems, and agent orchestration with CrewAI, LangGraph, and custom agents.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bouclem/skills72026년 5월 31일 업데이트

bouclem의 스킬 모두 보기

이 스킬의 문제 신고