Skip to content

Commit 2056cba

Browse files
finishing to sleep
1 parent 424b0af commit 2056cba

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

docs/plot_dataset/treemap.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ def _build_figure(
464464
marker=dict(
465465
colors=[node["color"] for node in node_list],
466466
line=dict(color="white", width=1),
467-
pad=dict(t=10, r=10, b=10, l=10),
467+
pad=dict(t=15, r=15, b=15, l=15),
468468
),
469469
textinfo="text",
470470
hovertemplate="%{customdata[0]}<extra></extra>",
@@ -473,18 +473,28 @@ def _build_figure(
473473
),
474474
textfont=dict(size=24),
475475
insidetextfont=dict(size=24),
476-
tiling=dict(pad=10, packing="squarify"),
477-
root=dict(color="rgba(255,255,255,0.95)"),
476+
# Increase pad to create more visual separation between tiles,
477+
# especially the top-level (population_type) nodes.
478+
tiling=dict(pad=8, packing="squarify"),
479+
# Slightly more transparent root to avoid harsh borders
480+
root=dict(color="rgba(255,255,255,0.98)"),
478481
)
479482
)
480483

484+
# Add legend swatches. increase marker size and use a thin white border so
485+
# legend squares visually separate from adjacent tiles when exported.
481486
for entry in deduped:
482487
fig.add_trace(
483488
go.Scatter(
484489
x=[0],
485490
y=[0],
486491
mode="markers",
487-
marker=dict(size=12, symbol="square", color=entry["color"]),
492+
marker=dict(
493+
size=14,
494+
symbol="square",
495+
color=entry["color"],
496+
line=dict(color="white", width=1.5),
497+
),
488498
name=entry["name"],
489499
showlegend=True,
490500
hoverinfo="skip",
@@ -541,11 +551,14 @@ def generate_dataset_treemap(
541551
aggregated = _filter_zero_nodes(aggregated, "dataset_name")
542552
nodes, legend_entries = _build_nodes(aggregated)
543553
fig = _build_figure(nodes, legend_entries)
554+
# Tune text sizes and margins so the increased padding doesn't cause
555+
# labels to overflow. Keeping uniformtext minsize slightly lower ensures
556+
# smaller tiles don't get crowded.
544557
fig.update_layout(
545-
uniformtext=dict(minsize=18, mode="hide"),
546-
margin=dict(t=60, l=32, r=220, b=40),
547-
hoverlabel=dict(font=dict(size=16), align="left"),
548-
height=860,
558+
uniformtext=dict(minsize=20, mode="hide"),
559+
margin=dict(t=56, l=28, r=28, b=36),
560+
hoverlabel=dict(font=dict(size=14), align="left"),
561+
height=880,
549562
)
550563

551564
out_path = Path(out_html)

docs/source/_templates/autosummary/module.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,19 @@
6363
{% endif %}
6464
{%- endblock %}
6565

66+
{% if sg_api_usage %}
67+
.. _sg_api_{{ fullname }}:
68+
69+
API Usage
70+
---------
71+
72+
.. raw:: html
73+
74+
<div class="sg-api-usage">
75+
76+
{{ sg_api_usage }}
77+
78+
.. raw:: html
79+
80+
</div>
81+
{% endif %}

0 commit comments

Comments
 (0)