首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

带误差棒的折线图 —— R语言生物信息简单绘图代码分享

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")

  • 发表于:
  • 原文链接https://page.om.qq.com/page/Oy3oJa5zwhg0TMm7IFaPLEzw0
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券