Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add real legend_cols support for Bokeh #5669

Merged
merged 1 commit into from Apr 17, 2023
Merged

Add real legend_cols support for Bokeh #5669

merged 1 commit into from Apr 17, 2023

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Mar 23, 2023

In Bokeh 3.1 support for ncols and nrows was added. This PR implements that. Before that legend_cols was only used to determine if the legend should be horizontal or vertical.

Current behavior

current_bokeh

Behavior after this PR

pr_bokeh

Matplotlib behavior

matplotlib

import holoviews as hv
import panel as pn

hv.extension("bokeh")
# hv.extension("matplotlib")


curves = [hv.Curve([i] * 10, label=str(i)) for i in range(10)]
data = [(0, 0, "A"), (1, 1, "B"), (2, 2, "C")]
optss = [
    dict(show_legend=True, legend_cols=2),
    dict(show_legend=True, legend_cols=2, legend_position="top"),
    dict(show_legend=True),
    dict(show_legend=True, legend_position="top"),
]


plots = []
for opts in optss:
    ol = hv.Overlay(curves).opts(**opts)
    bar = hv.Points(data, vdims=["y", "color"]).opts(color="color", **opts)
    plots.append(pn.Column(ol, bar))

pn.Row(*plots).servable()

@codecov-commenter
Copy link

codecov-commenter commented Mar 23, 2023

Codecov Report

Merging #5669 (0408a24) into main (0b837fc) will decrease coverage by 0.01%.
The diff coverage is 63.63%.

@@            Coverage Diff             @@
##             main    #5669      +/-   ##
==========================================
- Coverage   88.29%   88.29%   -0.01%     
==========================================
  Files         302      302              
  Lines       62541    62545       +4     
==========================================
+ Hits        55220    55221       +1     
- Misses       7321     7324       +3     
Impacted Files Coverage Δ
holoviews/plotting/bokeh/element.py 88.11% <63.63%> (-0.10%) ⬇️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@hoxbro hoxbro added this to the 1.16.0 milestone Apr 7, 2023
Copy link
Member

@philippjfr philippjfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very, very excited to finally have support for this one. The changes look good.

@hoxbro hoxbro merged commit 028c1da into main Apr 17, 2023
16 checks passed
@hoxbro hoxbro deleted the bokeh_cols branch April 17, 2023 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants