holoviews icon indicating copy to clipboard operation
holoviews copied to clipboard

Attach ScaleBar to subcoordinate axis

Open droumis opened this issue 1 year ago • 4 comments

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: https://github.com/bokeh/bokeh/issues/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 avatar Jun 23 '24 22:06 droumis

@hoxbro , this is unblocked now with https://github.com/bokeh/bokeh/pull/14005

droumis avatar Aug 06 '24 14:08 droumis

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

Did you mean that progress has been made?

hoxbro avatar Aug 06 '24 14:08 hoxbro

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

droumis avatar Aug 06 '24 14:08 droumis

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

droumis avatar Aug 06 '24 15:08 droumis

This issue 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[bot] avatar Jan 28 '25 01:01 github-actions[bot]