{
  "name": "Argument map between base R curve() and ggplot2 geom_function()/stat_function()",
  "description": "Compares the arguments and defaults of base R curve() with ggplot2 geom_function() and stat_function() for plotting a function, compiled by hand from the two official reference pages.",
  "page": "https://casrai.org/guides/plot-function-in-r",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-16T21:58:16Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Task",
      "unit": "",
      "description": ""
    },
    {
      "name": "curve() argument",
      "unit": "",
      "description": ""
    },
    {
      "name": "geom_function() / stat_function() argument",
      "unit": "",
      "description": ""
    },
    {
      "name": "Default",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Task": "Function to plot",
      "curve() argument": "expr",
      "geom_function() / stat_function() argument": "fun",
      "Default": "none; must be vectorised"
    },
    {
      "Task": "Range of x",
      "curve() argument": "from, to (or xlim)",
      "geom_function() / stat_function() argument": "xlim (or the plot x scale)",
      "Default": "curve: 0 to 1 for a new plot; ggplot2: NULL"
    },
    {
      "Task": "Number of evaluation points",
      "curve() argument": "n",
      "geom_function() / stat_function() argument": "n",
      "Default": "101 in both"
    },
    {
      "Task": "Add to an existing plot",
      "curve() argument": "add = TRUE",
      "geom_function() / stat_function() argument": "add another layer",
      "Default": "curve: add = FALSE"
    },
    {
      "Task": "Extra parameters for the function",
      "curve() argument": "write inside expr",
      "geom_function() / stat_function() argument": "args = list(...)",
      "Default": "ggplot2: empty list"
    },
    {
      "Task": "Rename the variable",
      "curve() argument": "xname",
      "geom_function() / stat_function() argument": "not applicable (use an anonymous function)",
      "Default": "curve: x"
    },
    {
      "Task": "Line type",
      "curve() argument": "type",
      "geom_function() / stat_function() argument": "geom (for example geom = point)",
      "Default": "curve: type = l"
    }
  ],
  "sources": [
    {
      "title": "R documentation: curve (graphics package)",
      "url": "https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/curve.html",
      "accessed": "2026-11-14"
    },
    {
      "title": "ggplot2 reference: geom_function and stat_function",
      "url": "https://ggplot2.tidyverse.org/reference/geom_function.html",
      "accessed": "2026-11-14"
    }
  ]
}