简体   繁体   中英

Line plot with mean and sd in R

It as answered

I would like to do a plot if show the heating curve of a ring where the points have the mean and standard deviation. There are the data:

mean_ring = c(25.81667, 16.29167, 17.99167, 19.25000, 19.90833, 20.81667)    
sd_ring = c(4.806025, 1.803259, 1.864724, 2.436652, 2.344610, 3.300918)    
time = c("Pre", 0, 5, 10, 15, 20)   
df_ring <- data.frame(mean_ring, sd_ring, time)

thank you!

would something like,

timeNumeric <- seq(-5, 20, 5)

# install.packages(c("tidyverse"), dependencies = TRUE)
library(ggplot2)

p <- ggplot(df_ring, aes(x= timeNumeric, y= mean_ring)) + 
       geom_line() + geom_point() + 
       geom_errorbar(aes(ymin = mean_ring-sd_ring, ymax= mean_ring + sd_ring), 
         width=.2, position=position_dodge(0.05))
p + labs(title="Heating curve of a ring", y="Mean temperature", x = "Time")  + 
       scale_x_time(breaks = timeNumeric, labels = time)

环的加热曲线

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM