holoviz / holoviz/hvplot

Using 'top_left' legend in a Layout plot cuts out a part of the plot

Open
#1,583 5 comments 0 reactions 0 assignees View on GitHub
upstream
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

#### ALL software version info
(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc should be added within the dropdown below.)

Software Version Info

```plaintext
Bokeh: 3.7.3
hvPlot: 0.11.3.dev47+g816845f.d20250515
Pandas: 2.2.3
```

#### Description of expected behavior and the observed behavior
**Expected behaviour**
Creating a layout of multiple scatter plots in a 2 column grid should show the full plots.

**Observed behaviour**
Using `legend='top_left'` in any of the plots will cut parts of the plot out.

#### Complete, minimal, self-contained example code that reproduces the issue

```python
import hvplot.pandas # noqa
import hvsampledata

df = hvsampledata.penguins("pandas")

width = 300

plot1 = df.hvplot.scatter(x='flipper_length_mm', y='body_mass_g', by='species',
title="Default: legend=right", frame_width=width)
plot2 = df.hvplot.scatter(x='flipper_length_mm', y='body_mass_g', by='species',
legend='left', title="legend=left", frame_width=width)
plot3 = df.hvplot.scatter(x='flipper_length_mm', y='body_mass_g', by='species',
legend='top_right', title="legend=top_right", frame_width=width)
plot4 = df.hvplot.scatter(x='flipper_length_mm', y='body_mass_g', by='species',
legend='top_left', title="legend=top_left", frame_width=width) # The culprit

```

#### Screenshots or screencasts of the bug in action
**First layout**
```python
(plot1 + plot2 + plot3 + plot4).cols(2)
```

![Image](https://github.com/user-attachments/assets/dd3d6b16-7e96-4055-965e-4a757958643a)

**Second layout**
```python
(plot4 + plot1 + plot2 + plot3).cols(2)
```

![Image](https://github.com/user-attachments/assets/dc84dd7a-70e2-4442-b739-4800d8d35119)

**Third layout**
```python
(plot3 + plot4 + plot1 + plot2).cols(2)
```

![Image](https://github.com/user-attachments/assets/133e49e1-af45-4e1a-a6cb-249916b89249)

**Fourth layout**
```python
(plot2 + plot3 + plot4 + plot1).cols(2)
```

![Image](https://github.com/user-attachments/assets/0660bcb4-66fe-4fda-a344-10414df5d083)

**Standalone plot (All copacetic)**

![Image](https://github.com/user-attachments/assets/a79c4d61-607b-43d7-aadb-2fb5298247a4)

- [ ] I may be interested in making a pull request to address this

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.