Files
Physics-Lab-Report/plot2/plot.R
2024-03-13 21:59:22 -05:00

34 lines
558 B
R

library(ggplot2)
library(readr)
library(latex2exp)
dat <- read_csv("M,a
0,0")
x_lab <- function() {
TeX(r"($M$)")
}
y_lab <- function() {
TeX(r"($a \ \small{m \cdot s^{-2}}$)")
}
plt <- ggplot(data = dat, aes(x = M, y = a)) +
geom_segment(x = 0,
y = 0,
xend = 1,
yend = 9.8,
col = "#0072B2",
size = 1) +
labs(x = x_lab(),
y = y_lab()) +
expand_limits(y = c(0, 10), x = c(0, 1))
plt
ggsave("plot.svg",
plot = plt,
width = 5,
height = 5,
)