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

Proposed replacement for gf_fun() #59

Open
dtkaplan opened this issue Oct 19, 2017 · 3 comments
Open

Proposed replacement for gf_fun() #59

dtkaplan opened this issue Oct 19, 2017 · 3 comments

Comments

@dtkaplan
Copy link

In updating mosaicCalc I've written a function plot_f1() as a prototype for bringing ggformula graphics into the calculus vignette.

ggformula already contains gf_fun(), which is good for plotting a function of one variable. What's different about plot_f1() is that it will plot functions of several variables. The formula that defines the function is used to specify which is the x-axis variable. The conditional part of the formula (if any) specifies the variables to be used for faceting. Additional arguments, e.g. color = ~ a, can be used for variables that don't appear to the right of the tilde.

An example (that's way too elaborate):

plot_f1(A * sin(2 * pi * t/P) ~ t | P, 
            t = c(0,100), P = 10*(1:3),  A = 1:3, color = ~ A)

image

I've rewritten (and expanded) the examples given in the docs for gf_fun(). This indicates that plot_f1() could be used as a replacement for gf_fun(). To me it makes much more sense to add it to ggformula than to have an independent function in mosaicCalc.

You can see plot_f1() in action by installing mosaicCalc from GitHub.

If this seems like a good line to persue, I'll extend it to handle functions of the form sin(a * x) ~ x +a in which case it will draw a contour plot of the LHS in the space defined by the RHS.

@rpruim
Copy link

rpruim commented Nov 13, 2017

This dropped off my radar and I haven't played with it yet.

A few questions:

  • Is this a drop-in replacement for gf_fun()? Does it only add use cases, or does it change behavior?
  • Does it play well with other layers?
  • What happens if you don't specify the values for t and P?

I'll have to look at it more carefully later, but if it only extends gf_fun(), there is probably no downside to replacing gf_fun() in ggformula.

@rpruim
Copy link

rpruim commented Apr 28, 2018

@dtkaplan, any more work on this? Should we try replacing gf_fun()?

@dtkaplan
Copy link
Author

I haven't followed up on this. Since the mosaicCalc package isn't widely used, let's defer this issue until when I start working to update the documentation for mosaicCalc.

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

No branches or pull requests

2 participants