plotly / plotly/plotly.R

ggplot to ggplotly does not accept variable alpha

Open
#1,469 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug difficulty: high ggplotly
Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied R reproducible example and the ggplotly(p) entry point, focusing on conversion of the variable alpha aesthetic. Done means the example converts without an error and preserves the variable alpha behavior shown in the original ggplot.

Written by the indexing model from the issue text.

Assessment

Tech stack
plotly, r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.