Skip to content

Computation failed in stat_function() for non-numeric values of x #1509

Description

@atfg

Drawing a line with stat_function for x as factor used to work in ggplot2_1.0.0 and ggplot2_1.0.1. Doesn't work in ggplot2_2.0.0:

ggplot(iris,aes(x=factor(Species),Petal.Length)) + geom_violin() + stat_function(fun=function (x) as.numeric(x)^2, colour="red")

This works in ggplot2_2.0.0, but the x labels need fixing:

ggplot(iris,aes(x=as.numeric(Species),Petal.Length,group=as.numeric(Species))) + geom_violin() + stat_function(fun=function (x) as.numeric(x)^2, colour="red")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions