-
Notifications
You must be signed in to change notification settings - Fork 12
Description
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)
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.