From de3b6294f82cce06819f111734ef040fa5f4b73b Mon Sep 17 00:00:00 2001 From: Fritz Lekschas Date: Mon, 14 Aug 2023 21:37:46 -0400 Subject: [PATCH] Incorporate x axis y padding Fix #84 --- CHANGELOG.md | 1 + jscatter/compose.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 438c8b7..3b5b30c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Add the ability to show a tooltip upon hovering over a point via `scatter.tooltip(true)` ([#86](https://github.com/flekschas/jupyter-scatter/pull/86)) - Fix axes updating of linked scatter plots when panning and zooming ([#87](https://github.com/flekschas/jupyter-scatter/issues/87)) +- Fix missing x-axes of linked scatter plots ([#84](https://github.com/flekschas/jupyter-scatter/issues/84)) ## v0.13.2 diff --git a/jscatter/compose.py b/jscatter/compose.py index be50165..49b1ec7 100644 --- a/jscatter/compose.py +++ b/jscatter/compose.py @@ -5,6 +5,10 @@ from .jscatter import Scatter +AXES_LABEL_SIZE = 16; +AXES_PADDING_Y = 20; +AXES_PADDING_Y_WITH_LABEL = AXES_PADDING_Y + AXES_LABEL_SIZE; + def compose( scatters: Union[List[Scatter], List[Tuple[Scatter, str]]], sync_view: bool = False, @@ -193,9 +197,12 @@ def hover_handler(change): return hover_handler + has_labels = any([get_scatter(i)._axes_labels != False for i, _ in enumerate(scatters)]) + y_padding = AXES_PADDING_Y_WITH_LABEL if has_labels else AXES_PADDING_Y + for i, _ in enumerate(scatters): scatter = get_scatter(i) - scatter.height(row_height) + scatter.height(row_height - y_padding) trait_notifiers = scatter.widget._trait_notifiers