Skip to content

geom/stat_function no longer supported #1872

@Kezrael

Description

@Kezrael

I used to be able to run the following code to render the plot containing stat_function() interactive (it was actually used with renderPlotly in a shiny app, but I tried to keep it simple and reproductible) before updating to the latest versions of R Studio and Plotly:

p <- ggplot(data = data.frame(x = 0), mapping = aes(x = x)) + 
  stat_function(fun = function(x) x^2+3) + 
  stat_function(fun = function(x) 5) + 
  xlim(1, 5)

ggplotly(p)

Now it throws the error 1: In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) : geom_GeomFunction() has yet to be implemented in plotly..

Activity

superjai

superjai commented on Nov 18, 2020

@superjai

Hi @cpsievert! How about I give this issue a go?

wanga02

wanga02 commented on Mar 12, 2021

@wanga02

Hi all! Has this been resolved? I am having the same issue and can't find a workaround - would appreciate an update on this / would like to bump the issue. Thanks!

Kezrael

Kezrael commented on Mar 15, 2021

@Kezrael
Author

Far from an elegant workaround, but if it helps you, I'm mapping my function over a sharp enough grid and using geom_line() to represent it. Hope it gets sorted out though.

wanga02

wanga02 commented on Mar 31, 2021

@wanga02

Ooh @Kezrael would love to see an example / understand more clearly what you mean by that? I'm trying to figure out a workaround at the mo!

v-vieira

v-vieira commented on Jul 9, 2021

@v-vieira

Until this issue is not solved, one workaround is to use a previous version of ggplot2.
To me, the version 3.1.1 worked smoothly.
Hope this issue is solved soon.

added a commit that references this issue on Oct 8, 2021
6dae230
added a commit that references this issue on Oct 14, 2021
e3043ae
added a commit that references this issue on Jul 4, 2022
55f49ee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @cpsievert@superjai@Kezrael@wanga02@v-vieira

        Issue actions

          geom/stat_function no longer supported · Issue #1872 · plotly/plotly.R