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

R API: ggplot2 ggplotly(): geom_smooth() not supported #179

Closed
brianboonstra opened this issue Mar 9, 2015 · 1 comment · Fixed by #183
Closed

R API: ggplot2 ggplotly(): geom_smooth() not supported #179

brianboonstra opened this issue Mar 9, 2015 · 1 comment · Fixed by #183

Comments

@brianboonstra
Copy link

Trying to make a plot with geom_smooth() ends up without the smoothing layer. The error message is

In layer2traces(L, df, misc): Conversion not implemented for geom_smooth (basic geom_smooth),
ignoring. Please open an issue with your example code at https://github.com/ropensci/plotly/issues

Code to reproduce is as follows

raw_data = Quandl(c('WIKI/XOM', "NSE/OIL"))
clean.quandl.name <- function(x) {
cleaned <- x
if (x=='Date') {} else {
    tryCatch({
                parts <- stringr::str_split(x, " - ",n=2)
                first.parts <- stringr::str_split(parts[[1]][[1]], "\\.",n=2)
                cleaned <- paste(first.parts[[1]][[2]], parts[[1]][[2]], sep=".")
                cleaned <- str_replace_all(cleaned," ","")
                },
             error = function(e) {cat(paste0("Err on",x,"\n"))}
             )
}
stringr::str_trim(cleaned)
}
fixed.names <- lapply(names(raw_data),clean.quandl.name)
renamed_data <- raw_data
names(renamed_data) <- fixed.names
gp <- ggplot(renamed_data, aes(x=OIL.Open, y=XOM.Open))+geom_point()+geom_smooth()
py <- plotly()
response <- py$ggplotly(gp)

My output looked like this:

but should have looked like this:
unknown

@chriddyp
Copy link
Member

chriddyp commented Mar 9, 2015

Thanks for reporting and for the simple example! I just put the example in our master list here: #161

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

Successfully merging a pull request may close this issue.

2 participants