Created
December 30, 2024 13:34
-
-
Save abikoushi/57c7de65af5598b38f6e7f039a259055 to your computer and use it in GitHub Desktop.
An example of line chart with markers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(dplyr) | |
lr_default <- function(t, delay, forgetting){ | |
(t+delay)^(-forgetting) | |
} | |
linedf <- expand.grid(delay=c(1,2), forgetting=c(0.6,0.9), t=seq(0,20, length.out=50)) %>% | |
mutate(lr=lr_default(t, delay, forgetting)) %>% | |
mutate(param = paste0("delay=",delay, ", ", "forgetting=", forgetting)) %>% | |
group_by(param) %>% | |
mutate(dummy=seq(1L, 50L, length.out=50) %% 5) %>% | |
ungroup() | |
pointdf <- dplyr::filter(linedf, dummy==1L) | |
ggplot(linedf, aes(x=t, y=lr,colour=param,shape=param))+ | |
geom_line(aes(linetype = param))+ | |
geom_point(data = pointdf)+ | |
theme_classic(16) | |
ggsave("lr.jpeg") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment