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

enh: Add Scalebar support for subcoordinate_y plots #6403

Merged
merged 8 commits into from
Oct 15, 2024
Merged

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Oct 4, 2024

Resolves #6292

Example:

import holoviews as hv
import numpy as np
hv.extension("bokeh")

common_opts = dict(subcoordinate_y=True, scalebar=True, scalebar_unit=('cm', 'm'),)

c1 = hv.Curve(np.random.rand(1000), label='c1').opts(color='lightblue',  scalebar_location="left", **common_opts)
c2 = hv.Curve(np.random.rand(1000), label='c2').opts(color='indianred', scalebar_location="right", **common_opts)
c3 = hv.Curve(np.random.rand(1000), label='c3').opts(color='plum', scalebar_location="left", **common_opts)
c4 = hv.Curve(np.random.rand(1000), label='c4').opts(color='palegreen', scalebar_location="right", **common_opts)

curves = hv.Overlay(c1 * c2 * c3 * c4).opts(show_legend=False)
curves.opts(width=800, height=600)

image

@hoxbro hoxbro added the type: enhancement Minor feature or improvement to an existing feature label Oct 4, 2024
@hoxbro hoxbro force-pushed the scalebar_coordinate_y branch 2 times, most recently from 3f9bb97 to 3dbaa42 Compare October 4, 2024 09:47
Copy link

codecov bot commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 97.29730% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.50%. Comparing base (f9c7f05) to head (65cb860).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
holoviews/plotting/bokeh/element.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6403      +/-   ##
==========================================
+ Coverage   88.48%   88.50%   +0.01%     
==========================================
  Files         323      323              
  Lines       68469    68563      +94     
==========================================
+ Hits        60588    60681      +93     
- Misses       7881     7882       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hoxbro hoxbro marked this pull request as ready for review October 4, 2024 15:19
@droumis
Copy link
Member

droumis commented Oct 7, 2024

@mattpap, is there any way to keep the label text horizontal and put it to the side of a vertically oriented scale bar? Right now, when the text is bigger than the bar, the text will offset the positioning of the bar.

image

@mattpap
Copy link

mattpap commented Oct 10, 2024

is there any way to keep the label text horizontal and put it to the side of a vertically oriented scale bar?

Currently label orientation is "idiomatic" and not configurable, but I can add an option for this.

Right now, when the text is bigger than the bar, the text will offset the positioning of the bar.

I suppose that a bug on its own.

Copy link
Member

@droumis droumis left a comment

Choose a reason for hiding this comment

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

Looks good, just with a minor comment/suggestion about getting the renderer.

holoviews/plotting/bokeh/element.py Outdated Show resolved Hide resolved
@hoxbro hoxbro enabled auto-merge (squash) October 15, 2024 11:04
@hoxbro hoxbro merged commit 75888ac into main Oct 15, 2024
14 checks passed
@hoxbro hoxbro deleted the scalebar_coordinate_y branch October 15, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attach ScaleBar to subcoordinate axis
4 participants