graphPaper: Traditional graph-paper axes

graphPaperR Documentation

Traditional graph-paper axes

Description

graphPaper plots out traditional graph-paper axes for making mathematical plots. Whereas standard R graphics put the axes at the edge of the plotting window, graphPaper puts them through the zeros and lets you set explicitly the location of tick marks and graph-paper rules. You can then plot over the axes by using functions such as lines, points, or funPlot (with add=TRUE).

Usage

graph_paper(
  P = NULL,
  xticks = 0:5,
  yticks = xticks,
  show_labels = FALSE,
  no_axes = TRUE,
  xlabels = xticks,
  ylabels = yticks,
  extend = 0.1,
  xlim = c(min(xticks), max(xticks)),
  ylim = c(min(yticks), max(yticks)),
  xlab = "x",
  ylab = "y",
  maxxlabels = 7,
  maxylabels = 7,
  ...
)

Arguments

xticks

numerical vector listing the position of x-axis ticks

yticks

like xticks but for y-axis

show_labels

logical (default: FALSE) whether to place axis labels.

no_axes

logical (default: TRUE) Do not display the x and y axes

xlabels

as in plot, sets the y-axis label

ylabels

similarly, set the y-axis label

xlab

Label for horizontal axis

ylab

Label for vertical axis

Value

a ggplot2 object

Author(s)

Daniel Kaplan (kaplan@macalester.edu)

Examples

graph_paper(xticks=-5:5, yticks=seq(-1, 1, by=.25),
            ylabels = c(-1, 1)) %>%
  graphFun(sin((x^2) / 3)~x, x=range(-4, 4), color="blue")


dtkaplan/Znotes documentation built on Sept. 4, 2022, 10:21 a.m.