Closed absripad closed 1 year ago
Looking for way to display outputs from Folium and pivis.Network on Shiny
Code attached. Works for ipyleaflet maps.
import folium from shiny import * from shinywidgets import output_widget, register_widget, render_widget import ipyleaflet as L
m = folium.Map(location=[45, -122], zoom_start = 12) m.save('map.html')
app_ui = ui.page_fluid( ui.output_text_verbatim("txt"), output_widget('ddd') )
def server(input, output, session): @output @render.text def txt(): return 'Map from Folium'
@output @render_widget def ddd(): return m() # return m # Does NOT Work # return m._repr_html_() # Does NOT Work # return L.Map(center=(51, 0), zoom=12) # WORKS!
app = App(app_ui, server)
Duplicate of #71 and #63 (please see this comment https://github.com/posit-dev/py-shinywidgets/issues/71#issuecomment-1815433007)
Description
Looking for way to display outputs from Folium and pivis.Network on Shiny
Code attached. Works for ipyleaflet maps.
import folium from shiny import * from shinywidgets import output_widget, register_widget, render_widget import ipyleaflet as L
m = folium.Map(location=[45, -122], zoom_start = 12) m.save('map.html')
app_ui = ui.page_fluid(
ui.output_text_verbatim("txt"), output_widget('ddd') )
def server(input, output, session):
@output @render.text def txt(): return 'Map from Folium'
app = App(app_ui, server)