Skip to content

Commit 985e245

Browse files
authored
Merge pull request #418 from anpicci/extend-minor-tick-handling-in-plots
Shorten minor ticks in stacked ratio plots
2 parents 24ef816 + ce8da17 commit 985e245

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

analysis/topeft_run2/make_cr_and_sr_plots.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3286,6 +3286,9 @@ def make_region_stacked_ratio_fig(
32863286
tick_labelsize = axes_style.get("tick_labelsize", 18)
32873287
tick_width = axes_style.get("tick_width", 1.5)
32883288
tick_length = axes_style.get("tick_length", 6)
3289+
minor_tick_length = axes_style.get("minor_tick_length")
3290+
if minor_tick_length is None:
3291+
minor_tick_length = tick_length * 0.6 if tick_length else 0
32893292
axis_label_fontsize = axes_style.get("label_fontsize", 18)
32903293
ratio_tick_labelsize = axes_style.get("ratio_tick_labelsize", tick_labelsize)
32913294
ratio_label_text = axes_style.get("ratio_label", "Ratio")
@@ -3482,6 +3485,7 @@ def make_region_stacked_ratio_fig(
34823485
ax.autoscale(axis="y")
34833486
ax.set_xlabel(None)
34843487
ax.tick_params(axis="both", labelsize=tick_labelsize, width=tick_width, length=tick_length)
3488+
ax.tick_params(axis="both", which="minor", width=tick_width, length=minor_tick_length)
34853489
if not use_log_y:
34863490
if isinstance(ticklabel_format_cfg, Mapping):
34873491
format_kwargs = dict(ticklabel_format_cfg)
@@ -3506,6 +3510,7 @@ def make_region_stacked_ratio_fig(
35063510
rax.tick_params(
35073511
axis="both", labelsize=ratio_tick_labelsize, width=tick_width, length=tick_length
35083512
)
3513+
rax.tick_params(axis="both", which="minor", width=tick_width, length=minor_tick_length)
35093514

35103515
# Ensure the ratio axis always includes a unity tick while preserving the
35113516
# spacing chosen by the existing locator and enforcing ticks at the bounds.

0 commit comments

Comments
 (0)