First, loading necessary libraries:
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(magrittr)
library(ggplot2)
Suppose I have the following data frame:
df = data.frame(n = 5:24, q2.5 = rnorm(20, 1, 0.1), median = rnorm(20, 4, .2), q97.5 = rnorm(20, 6, .05))
where the first column is the size parameters, median, q2.5, q97.5 are the median, 2.5th and 97.5th quantiles derived from each sample. The latter is the set of recorded means/medians for each particular case.
Then we may create the following plot:
df %>%
ggplot(aes(x=n)) +
geom_line(aes(y=median), size=1.25, color='black') +
geom_line(aes(y=q2.5), size=.5, color='black', linetype='dashed') +
geom_line(aes(y=q97.5), size=.5, color='black', linetype='dashed') +
coord_cartesian(ylim=c(0,8)) +
xlab('n') + ylab('mean') +
theme_classic()