debug-axes
プロットのスケール(対数軸など)、目盛、表示範囲の不具合を診断し、意図した見た目に修正する
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Debug Plot Axes Skill
This skill is for resolving issues where plot axis scales (especially log scales) or display ranges (ylim/xlim) in gwexpy do not appear as intended.
Diagnostic Procedures
-
Verify Internal State:
- Create a reproduction script and output
ax.get_yscale()orax.get_ylim()to confirm if the internal setting is actually 'log'.
- Create a reproduction script and output
-
Identity Visual Linearity Issues:
- If the internal state is 'log' but it visually appears linear, it is often due to the data range being too narrow (e.g., 1.0 vs 2.23).
- Check if ticks are appropriately placed via
ax.get_yticks().
-
Confirm Judgment Logic:
- Check if
determine_yscaleordetermine_xscaleingwexpy/plot/defaults.pycorrectly recognizes the data, using debug prints if necessary.
- Check if
Correction Guidelines
-
Enforce Scale Application:
- Explicitly call
ax.set_yscale()aftersuper().__init__withinPlot.__init__ingwexpy/plot/plot.py. - Always call
ax.autoscale_view()after application to force a visual update.
- Explicitly call
-
Automatic Range Expansion (Log Scale specific):
- If the data range is less than 100x (2 orders of magnitude), log scales often show few ticks, appearing linear.
- Implement or fix
determine_ylimlogic to ensure a range of approximately 2 orders of magnitude centered around the median.
-
Robust Type Checking:
- Since
isinstancechecks may fail due to environment differences (import sources), use duck-typing such astype(obj).__name__orhasattr(obj, 'frequencies')alongside it.
- Since
-
Prevent Duplicate Display in IPython/Jupyter:
- Set
_repr_html_ = Nonein thePlotclass to prevent duplicate displays (repr andplt.show).
- Set
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!