Skip to content

ggplot to ggplotly does not accept variable alpha #1469

Open
@aljrico

Description

@aljrico

I'm trying to convert a ggplot that has alpha in its aesthetics (it needs to be variable), which works perfectly in ggplot, but ggplotly() outputs an error.

set.seed(666)
y <- rpois(1000, 2.9)
table(y)

holdThis <- as.data.frame(table(y))
holdThis$cumTotal <- cumsum(holdThis$Freq)
holdThis$percentage <- (as.numeric(holdThis$Freq)/10000) * 100
holdThis$y <- as.numeric(as.character(holdThis$y))

p <- ggplot(holdThis, aes(x=y, y=Freq, alpha = Freq)) + geom_bar(stat='identity', fill= 'blue', color="black", size = .25) + scale_x_discrete(breaks = y)

image

ggplotly(p)
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions