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

Adding legend to boxplot #22

Open
BarisKal opened this issue May 7, 2019 · 2 comments
Open

Adding legend to boxplot #22

BarisKal opened this issue May 7, 2019 · 2 comments

Comments

@BarisKal
Copy link

BarisKal commented May 7, 2019

It is not possible to add a legend to a boxplot with dbplot.
https://stackoverflow.com/questions/56008148/dont-know-how-to-add-o-to-a-plot-with-r-package-dbplot

@edgararuiz-zz
Copy link
Owner

Thank you. In the meanwhile using db_compute_boxplot() will still push the calculations to Spark, and then you can create the boxplot manually, and adding the color option

library(dplyr, warn.conflicts = FALSE)
library(ggplot2)
library(dbplot)

mtcars %>%
  db_compute_boxplot(cyl, mpg) %>%
  ggplot() +
  geom_boxplot(
    aes(
      x = cyl,
      ymin = ymin,
      lower = lower,
      middle = middle,
      upper = upper,
      ymax = ymax,
      color = as.factor(cyl)
    ),
    stat = "identity"
  )

@BarisKal
Copy link
Author

BarisKal commented May 7, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants