Agent skill
debug_axes
プロットのスケール(対数軸など)、目盛、表示範囲の不具合を診断し、意図した見た目に修正する
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/debug-axes
SKILL.md
Debug Plot Axes Skill
このスキルは、gwexpyにおけるプロットの軸スケール(特に対数軸)や表示範囲(ylim/xlim)が意図通りに表示されない問題を解決するためのものです。
診断手順
-
内部状態の確認:
- 再現スクリプトを作成し、
ax.get_yscale()やax.get_ylim()を出力して、内部的な設定が 'log' になっているか確認する。
- 再現スクリプトを作成し、
-
視覚的リニア問題の特定:
- 内部状態が 'log' なのに見た目が線形(Linear)に見える場合、データ範囲が狭すぎることが原因であることが多い(例: 1.0 vs 2.23)。
- 目盛(ticks)が適切に振られているか、
ax.get_yticks()で確認する。
-
判定ロジックの確認:
gwexpy/plot/defaults.pyのdetermine_yscaleやdetermine_xscaleが正しくデータを認識しているか、デバッグプリント等で確認する。
修正ガイドライン
-
スケールの強制適用:
gwexpy/plot/plot.pyのPlot.__init__内で、super().__init__の後に明示的にax.set_yscale()を呼び出す。- 適用後には必ず
ax.autoscale_view()を呼び出して、視覚的な更新を強制する。
-
表示範囲の自動拡張 (Log Scale 特有):
- データ範囲が100倍(2桁)未満の場合、対数軸では目盛がほとんど表示されないため、線形に見えやすい。
determine_ylimロジックを実装/修正し、データの中央値を中心に約2桁分の範囲を確保するようにylimを設定する。
-
堅牢な型判定:
isinstanceチェックが環境(インポート元)の違いで失敗する場合があるため、type(obj).__name__やhasattr(obj, 'frequencies')などのダックタイピングを併用して判定を行う。
-
IPython/Jupyterの重複表示防止:
Plotクラスで_repr_html_ = Noneを設定し、重複表示(reprとplt.show)を防止する。
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?