-
Notifications
You must be signed in to change notification settings - Fork 113
Closed
Labels
Milestone
Description
When getting mouse event on ui.output_plot()
, e.g., click
, brush
, etc., the input value accessed in the server does not correctly represents user's input on a plot.
For example, a snapshot below shows that I dragged a region for [2, 3]
on x-axis and [20, 30]
on y-axis, but the input values were read as [1.7, 2.9]
for x-axis and [21.9, 30.6]
for y-axis.

Below is an app code:
from shiny import App, render, ui, req
from plotnine import ggplot, aes, geom_point
from pydataset import data
mtcars = data("mtcars")
app_ui = ui.page_fluid(
ui.output_plot("plot", brush=True),
ui.output_text_verbatim("info"),
)
def server(input, output, session):
@render.plot
def plot():
res = (ggplot(mtcars, aes('wt', 'mpg'))
+ geom_point())
return res
@render.text
def info():
req(input.plot_brush())
return input.plot_brush()
app = App(app_ui, server)