Skip to content

Instantly share code, notes, and snippets.

@brshallo
Last active December 22, 2021 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brshallo/78d0682d16b7eb09ee39caa4eba3fc06 to your computer and use it in GitHub Desktop.
Save brshallo/78d0682d16b7eb09ee39caa4eba3fc06 to your computer and use it in GitHub Desktop.
Nice way to pass in arbitrary labels to plotly::ggplotly()
library(ggplot2)
custom_ggplot <- function(df, x, y, ...){
ggplot(mpg, aes(x = cty, y = hwy, ...))+
geom_point()
}
custom_ggplot(color = class)
p <- custom_ggplot(class = class, displ = displ)
plotly::ggplotly(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment