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

Incorrect input values of mouse event position with {plotnine} #1007

Closed
youngroklee-ml opened this issue Jan 13, 2024 · 2 comments
Closed

Incorrect input values of mouse event position with {plotnine} #1007

youngroklee-ml opened this issue Jan 13, 2024 · 2 comments
Milestone

Comments

@youngroklee-ml
Copy link

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.

plotnine-brush-position

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)
@jcheng5 jcheng5 changed the title Incorrect input values of mouse event position with {plotline} Incorrect input values of mouse event position with {plotnine} Jan 16, 2024
@wch wch added this to the v0.7.0 milestone Jan 16, 2024
@wch
Copy link
Collaborator

wch commented Jan 17, 2024

I believe this is the same as has2k1/plotnine#738, and should be fixed by #999.

@wch
Copy link
Collaborator

wch commented Jan 17, 2024

This has been fixed by #999.

@wch wch closed this as completed Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants