Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

layer_model_predictions won't take functions in formula argument #209

Closed
nswitanek opened this issue Jun 30, 2014 · 1 comment
Closed

layer_model_predictions won't take functions in formula argument #209

nswitanek opened this issue Jun 30, 2014 · 1 comment

Comments

@nswitanek
Copy link

Having trouble specifying formula in layer_model_predictions:

Would like to do similar to:

ggplot(cocaine, aes(x = weight, y = price)) + 
    geom_point() +
    geom_smooth(colour = 'cadetblue', se = FALSE, size = 1) +
    geom_smooth(method = 'lm', formula = y ~ poly(x, 3), color = 'darkorange', se = FALSE, size = 1)

But neither of these work:

cocaine %>%
  ggvis(~weight, ~price) %>%
  layer_smooths(stroke := "cadetblue") %>%
  layer_model_predictions(stroke := "darkorange", model = "lm", formula = price ~ poly(weight, 3))
cocaine %>%
  ggvis(~weight, ~price) %>%
  layer_smooths(stroke := "cadetblue") %>%
  layer_model_predictions(stroke := "darkorange", model = "lm", formula = y ~ poly(x, 3))
@kismsu
Copy link

kismsu commented Jul 11, 2014

It's because in pred_grid there is a condition "Only know how to make grid for one variable". Hope this will change.

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

No branches or pull requests

2 participants