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

subcoordinate_y: reverse the renderers by default #6194

Merged
merged 2 commits into from
Apr 16, 2024

Conversation

maximlt
Copy link
Member

@maximlt maximlt commented Apr 15, 2024

Addresses #6027

By reverting the orders of the subcoordinate-y glyph renderers.

import numpy as np
import holoviews as hv; hv.extension('bokeh')
from scipy.stats import gaussian_kde

categories = ['A', 'B', 'C', 'D', 'E']
data = {cat: np.random.normal(loc=i-2, scale=1.0, size=100) for i, cat in enumerate(categories)}
x = np.linspace(-5, 5, 100)

areas = []
for i, (cat, values) in enumerate(data.items()):
    pdf = gaussian_kde(values)(x)
        
    area = hv.Area((x, pdf), label=cat).opts(
        subcoordinate_y=True, 
        subcoordinate_scale=1.5,
    )
    areas.append(area)

ridge_plot_areas = (hv.VSpan(-4, -3) * hv.Overlay(areas) * hv.VSpan(3, 4)).opts(
    width=900,
    height=400,
)

ridge_plot_areas.opts(show_legend=False)
  • The blue VSpan is rendered first, that's the regular behavior as it's the first element in the overlay
  • The subcoord-y plots are rendered in the reversed order
  • The red VSpan is rendered last, that's the regular behavior

image

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.

Looks great, thanks!

@maximlt maximlt added the type: enhancement Minor feature or improvement to an existing feature label Apr 16, 2024
@maximlt maximlt merged commit 1568bdd into main Apr 16, 2024
11 of 12 checks passed
@maximlt maximlt deleted the subcoord_y_reverse_renderers branch April 16, 2024 12:17
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants