Skip to content

Commit fd6619f

Browse files
hanhouclaude
andcommitted
style(plot): narrower default figures + legend/title separation
- Reduce default width to 1000 for both plotly figures. - Time-based: pin the title top-left and add top margin so it clears the legend; make the legend entries compact (smaller font, 125px entries). - Trial-based: smaller legend font and more top margin for title separation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 00e55e3 commit fd6619f

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

src/aind_dynamic_foraging_basic_analysis/plot/plot_foraging_session_plotly.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,10 @@ def _smoothed_trace(num, den):
428428
ticktext.append(str(w))
429429
fig.update_xaxes(tickvals=tickvals, ticktext=ticktext, row=2, col=1)
430430
fig.update_layout(
431-
width=1300, height=440, template="simple_white",
432-
legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="left", x=0),
433-
margin=dict(l=60, r=20, t=60, b=50),
431+
width=1000, height=460, template="simple_white",
432+
legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="left", x=0,
433+
font=dict(size=9)),
434+
margin=dict(l=60, r=20, t=90, b=50),
434435
)
435436
return fig
436437

@@ -721,11 +722,13 @@ def _trial_of(times, _gc=gc, _n=n_tr):
721722
fig.update_xaxes(tickvals=tickvals, ticktext=ticktext, row=2, col=1)
722723

723724
fig.update_layout(
724-
title=title or "Session Scroller", showlegend=True,
725-
height=600, width=1300, template="simple_white",
726-
# Legend outside, top-left, horizontal, ~5 entries per row.
725+
# Title pinned to the very top-left so it clears the legend below it.
726+
title=dict(text=title or "Session Scroller", x=0.0, xanchor="left",
727+
y=0.98, yanchor="top"),
728+
showlegend=True, height=620, width=1000, template="simple_white",
729+
# Legend outside, top-left, horizontal, compact entries (narrow box).
727730
legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="left", x=0,
728-
entrywidthmode="fraction", entrywidth=0.2),
729-
margin=dict(l=70, r=20, t=90, b=40),
731+
font=dict(size=9), entrywidthmode="pixels", entrywidth=125),
732+
margin=dict(l=70, r=20, t=120, b=40),
730733
)
731734
return fig

0 commit comments

Comments
 (0)