Skip to content

Commit

Permalink
Incorporate x axis y padding
Browse files Browse the repository at this point in the history
Fix #84
  • Loading branch information
flekschas committed Aug 15, 2023
1 parent d723e77 commit de3b629
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 8 additions & 1 deletion jscatter/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit de3b629

Please sign in to comment.