@tojira/

example graphing (R)

R

No description

fork
loading
Files
  • main.r
  • Rplots.pdf
main.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
x = seq(0, 2*pi, 0.01)
sin = sin(x)
cos = cos(x)

plot.new()
plot.window(
  xlim = c(x[1], x[length(x)]),
  ylim = c(-1, 1)
)
grid()
title(
  main = "Trigonometric functions",
  xlab = "x",
  ylab = "y"
)
legend(
  "bottomleft",
  c("sin(x)", "cos(x)"),
  fill = c("blue", "red"),
  bg = "white"
)
axis(1)
axis(2)

lines(x, sin, type="l", col="blue")
lines(x, cos, type="l", col="red")