01
1、 加载包,读取数据
library(ggpubr)library(tidyverse)library(ggprism)
k82 <- readxl::read_xlsx("cck8/cck82.xlsx")
> k82# A tibble: 5 × 7 `0` `0.5` `1` `10` `15` `25` `50` <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>1 3.06 3.44 3.59 3.53 3.22 3.39 0.4952 3.43 3.01 2.98 3.19 3.13 2.66 0.6093 3.29 3.43 3.33 2.83 3.10 2.43 0.1534 3.35 3.57 3.60 3.56 3.21 2.47 0.0965 3.48 2.91 2.91 3.35 2.63 1.75 0.227
2、 数据预处理
k82_long <- k82%>% gather(key = Concentration ,value = 'long' )
k8_much <- k82_long%>% mutate(`Cell Viability` = unlist(lapply(k82_long$`long` , function(x){ as.numeric(x)/3.3224 })))
3、 绘图
library(MetBrewer)
isfahan <- MetBrewer::met.brewer("Isfahan1")length(isfahan)
ggline(k8_much, x = "Concentration", y = 'Cell Viability', ylim =c(0,1.2), xlab = "Concentration(mM)", add = c("mean_sd"), # color = "steelblue", color = met.brewer("Renoir")[8],
ggtheme = theme_prism(base_size = 14))
4、 简单折线图的绘制
df1 =data.frame(dose = c(0.5,1,1.5),len = c(4.2,5,6))# 构建数据框
## dose len## 1 D0.5 4.2## 2 D1 10.0## 3 D2 29.5# Basic plotggline(df1,x = "dose",y ="len")
领取专属 10元无门槛券
私享最新 技术干货