Reputation: 365
So I have a line graph that I want to look a little smoother than it currently is. Right now, there are a bunch of jagged edges on the graph, and I'd like it to curve a bit more. I tried using geom_smooth but that makes the largest y value close to 150 when it should be closer to 230 (as this graph shows). Any idea how to make this line chart a little smoother?
library(tidyverse)
library(ggplot2)
library(ggrepel)
library(dplyr)
source("https://raw.githubusercontent.com/samhoppen/2020_FF_Analysis/master/Functions/fpros_scrape_projections.R")
source("https://raw.githubusercontent.com/samhoppen/2020_FF_Analysis/master/Functions/set_vor.R")
position <- c("qb", "rb", "wr", "te")
week <- "draft"
crossing(position, week)
projections <- crossing(position = position, week = week) %>%
pmap_dfr(scrape_projections) %>%
mutate_at(vars(pass_yds, rush_yds, rec_yds), str_remove, ",") %>%
mutate_at(vars(pass_att:rec_tds), as.numeric) %>%
mutate_at(vars(team:position), as.factor) %>%
select(-c("week")) %>%
as_tibble()
default_baseline <- c(QB = 15, RB =72, WR = 90, TE = 30, K = 6)
vor_table <- set_vor(projections,
vor_baseline = default_baseline,
vor_var = "fpts")
ggplot() +
geom_line(data = vor_table,
aes(x = fpts_rank, y = fpts_vor))
Upvotes: 2
Views: 420
Reputation: 472
This might work:
ggplot()+
stat_smooth(data = vor_table, aes(x = fpts_rank, y = fpts_vor),
se = F, method = "lm", formula = y ~ poly(x, 10))
Upvotes: 1