Skip to content

Ipyleaflet widget_control not show correctly with widgets.Output #193

@xiaogangzhu

Description

@xiaogangzhu

Hi all,

I am trying to render a colorbar to the map but it is not working correctly. The code for this issue:

import ipywidgets as widgets

# make colorbar
colors = ["#d7191c", "#fdae61", "#ffffbf", "#abdda4", "#2b83ba"]
vmin = z_orig.min()
vmax = z_orig.max()
levels = len(colors) * 10
cm = branca.colormap.LinearColormap(colors, vmin=vmin, vmax=vmax).to_step(5)

output = widgets.Output()
position = "bottomright"
colormap_ctrl = ipyleaflet.WidgetControl(
            widget=output,
            position=position,
            # transparent_bg=transparent_bg,
            # **kwargs,
        )
with output:
    output.outputs = ()
    display(cm)

m = Map(
    center=[0, 0],
    zoom=3,
    scroll_wheel_zoom=True,
    basemap=basemaps.CartoDB.DarkMatter,
)

m.add(colormap_ctrl)

This work well in jupyterlab

Image
But not for shiny app, which only has a small point in the bottom right

Image
the version of each pacakage
shiny 1.2.1
shinywidgets 0.3.4
ipywidgets 7.8.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions