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

Using bokeh? #474

Closed
vfridkin opened this issue May 4, 2023 · 1 comment
Closed

Using bokeh? #474

vfridkin opened this issue May 4, 2023 · 1 comment

Comments

@vfridkin
Copy link

vfridkin commented May 4, 2023

Bokeh is an interactive charting library which seems a good fit with Shiny for Python. I've tried using pyecharts to no success so looking at this as an alternative. Is there a way to get it working?

from bokeh.plotting import figure, show
from shiny import App, render, ui

app_ui = ui.page_fluid(
    ui.output_ui("bokeh_test")
)


def server(input, output, session):

    @output
    @render.ui
    def bokeh_test():
        # prepare some data
        x = [1, 2, 3, 4, 5]
        y = [6, 7, 2, 4, 5]

        # create a new plot with a title and axis labels
        p = figure(title="Simple line example",
                   x_axis_label='x', y_axis_label='y')
        # add a line renderer with legend and line thickness to the plot
        p.line(x, y, legend_label="Temp.", line_width=2)
        return ui.HTML(show(p)) # Not working


app = App(app_ui, server, debug=True)
@cpsievert
Copy link
Collaborator

cpsievert commented May 4, 2023

You can via shinywidgets, but also beware that bokeh requires some additional setup and it doesn't (yet) support custom extensions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants