plotFunctions: plotFunctions

Description Usage Arguments Value Examples

View source: R/plotFunctions.R

Description

plotFunctions

Usage

1
2
plotFunctions(fun, params = NULL, n = 101, x = c(1, 5), size = 0.5,
  end_spaces = 0)

Arguments

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

Value

ggplot object

Examples

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)

itsaquestion/MyPlot documentation built on July 22, 2019, 8:40 p.m.