Description Usage Arguments Value Examples
View source: R/plotFunctions.R
plotFunctions
1 2 | plotFunctions(fun, params = NULL, n = 101, x = c(1, 5), size = 0.5,
end_spaces = 0)
|
fun |
function to plot |
params |
the function params |
n |
dots |
x |
range of x |
size |
line width |
end_spaces |
make some space for label at the end of lines |
ggplot object
1 2 3 4 5 6 7 8 9 | CRRA = function(x, theta){
if (theta == 1) {
return(log(x))
}
(x ^ (1 - theta) - 1) / (1 - theta)
}
params = data.frame(theta = c(0, 0.5, 1, 2, 4))
plotFunctions(CRRA, params, x = c(0.1, 5), size = 0.6, end_spaces = 0.05) +
ggtitle("CRRA") + ylim(-1, 4) + MyPlot::gghline(0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.