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

Attach ScaleBar to subcoordinate axis #6292

Closed
droumis opened this issue Jun 23, 2024 · 4 comments · Fixed by #6403
Closed

Attach ScaleBar to subcoordinate axis #6292

droumis opened this issue Jun 23, 2024 · 4 comments · Fixed by #6403
Assignees
Labels
type: enhancement Minor feature or improvement to an existing feature

Comments

@droumis
Copy link
Member

droumis commented Jun 23, 2024

Allow adding scale bars to individual subplot/subcoordinate_y ranges. The current implementation only allows for a scale bar to be positioned relative to the entire plot. This depends on progress in Bokeh: bokeh/bokeh#13921

A possible API might be to use a new arg; something like scalebar_level="subcoordinate_y"

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

# scalebar_level="subcoordinate_y")

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

c1 = hv.Curve(np.random.rand(1000), label='c1').opts(color='lightblue',  scalebar_location="left", scalebar_opts={'bar_length':.1, 'background_fill_alpha': .2, 'bar_line_color':'darkblue'}, **common_opts)
c2 = hv.Curve(np.random.rand(1000), label='c2').opts(color='indianred', scalebar_location="bottom_right", scalebar_opts={'bar_length':.1, 'background_fill_alpha': .2, 'bar_line_color':'darkred'}, **common_opts)
c3 = hv.Curve(np.random.rand(1000), label='c3').opts(color='plum', scalebar_location="top_left", scalebar_opts={'bar_length':.1, 'background_fill_alpha': .2, 'bar_line_color':'purple'}, **common_opts)
c4 = hv.Curve(np.random.rand(1000), label='c4').opts(color='palegreen', scalebar_location="right", scalebar_opts={'bar_length':.1, 'background_fill_alpha': .2, 'bar_line_color':'darkgreen'}, **common_opts)

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

Arrows indicate where the scale bars should be after applying to subcoordinate level:

image

@droumis droumis added the TRIAGE Needs triaging label Jun 23, 2024
@droumis droumis moved this to Todo in CZI R5 neuro Jun 23, 2024
@hoxbro hoxbro added type: enhancement Minor feature or improvement to an existing feature and removed TRIAGE Needs triaging labels Jun 27, 2024
@droumis
Copy link
Member Author

droumis commented Aug 6, 2024

@hoxbro , this is unblocked now with bokeh/bokeh#14005

@hoxbro
Copy link
Member

hoxbro commented Aug 6, 2024

It is not unblocked, e.g., I can't do any development in HoloViews yet.

Did you mean that progress has been made?

@droumis
Copy link
Member Author

droumis commented Aug 6, 2024

If that PR is functionally ready, can't we start exploring how it can implemented in HoloViews?

@droumis
Copy link
Member Author

droumis commented Aug 6, 2024

discussion: dev release of Bokeh 3.6, then dev release of Panel (supporting Bokeh 3.6) needed prior to doing any HoloViews work on this

check in ~2 weeks

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 a pull request may close this issue.

2 participants