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

Consider creating gf_fun2d() for plotting functions of two variables #98

Closed
rpruim opened this issue Jun 27, 2018 · 3 comments
Closed

Comments

@rpruim
Copy link

rpruim commented Jun 27, 2018

This would be like mosaic::plotFun().

@rpruim
Copy link
Author

rpruim commented Jun 28, 2018

Prototype created:

library(ggformula)
#> Loading required package: ggplot2
#> 
#> New to ggformula?  Try the tutorials: 
#>  learnr::run_tutorial("introduction", package = "ggformula")
#>  learnr::run_tutorial("refining", package = "ggformula")
theme_set(theme_bw())
gf_function_2d( fun = function(x, y) sin(2 * x * y), xlim = c(-pi, pi), ylim = c(-pi, pi)) %>%
  gf_refine(scale_fill_viridis_c())

gf_function_2d( fun = function(x, y) x + y, contour = FALSE) %>%
  gf_refine(scale_fill_viridis_c())

gf_function_tile(fun = function(x, y) x * y) %>%
gf_function_contour(fun = function(x, y) x * y, color = "white") %>%
  gf_refine(scale_fill_viridis_c())

gf_fun_tile(x * y ~ x + y, xlim = c(-2, 2), ylim = c(-3, 3)) %>%
  gf_fun_contour(x * y ~ x + y, color = "white") %>%
  gf_refine(scale_fill_viridis_c())

Created on 2018-06-28 by the reprex package (v0.2.0).

@rpruim
Copy link
Author

rpruim commented Jun 29, 2018

Trying to decide what the default label for the fill guide should be. f.value is just a place holder.

It can, of course, be overridden using gf_labs()

@rpruim
Copy link
Author

rpruim commented Jul 31, 2018

Current plan: default is no label on the fill. Users can use gf_labs() to add a label if one is desired.

library(ggformula)
theme_set(theme_bw())
gf_function_2d( fun = function(x, y) sin(2 * x * y), xlim = c(-pi, pi), ylim = c(-pi, pi)) %>%
  gf_refine(scale_fill_viridis_c())

Created on 2018-07-31 by the reprex package (v0.2.0).

@rpruim rpruim closed this as completed in c734f40 Jul 31, 2018
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

1 participant