本文主要展示如何利用R语言绘制来自nature期刊USP14-regulated allostery of the human proteasome by time-resolved cryo-EM(Shuwen Zhang, et al,2022)[1]一文中的Extended Data Fig.7h。该图形式为折线图。如下图所示:
![](https://oss-emcsprod-public.modb.pro/wechatSpider/modb_20221009_6a619544-477e-11ed-a381-fa163eb4f6be.png)
![](https://oss-emcsprod-public.modb.pro/wechatSpider/modb_20221009_6a8c4a64-477e-11ed-a381-fa163eb4f6be.png)
1、图形绘制
setwd("C:\\Users\\Acer\\Desktop")
library(dplyr)
library(ggplot2)
zhang_ed.fig7 <- readxl::read_xlsx("41586_2022_4671_MOESM7_ESM.xlsx")
head(zhang_ed.fig7)
# type `RPT1-Y249` `RPT2-Y259` `RPT6-F223` `RPT3-Y239` `RPT4-Y207` `RPT5-F260`
# <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#1 EA1UBL 37.3 34.6 47.9 55.9 47.5 41.9
#2 EA2.0UBL 36.5 32.9 45.2 54.8 47 42.1
#3 EA2.1UBL 37 33.3 47.9 55.9 47.8 42.3
#4 SBUSP14 36.9 34.9 47.1 56.2 48.2 42.2
#5 SCUSP14 38.1 35.1 45.8 55.8 48.7 43.5
#6 SD4USP14 38.9 34 53.1 54.4 49 43.6
fig7.h <- zhang_ed.fig7 %>% reshape2::melt(id.vars = "type", variable.name = "class", value.name = "value")
head(fig7.h)
# type class value
#1 EA1UBL RPT1-Y249 37.3
#2 EA2.0UBL RPT1-Y249 36.5
#3 EA2.1UBL RPT1-Y249 37.0
#4 SBUSP14 RPT1-Y249 36.9
#5 SCUSP14 RPT1-Y249 38.1
#6 SD4USP14 RPT1-Y249 38.9
str(fig7.h)
#'data.frame': 42 obs. of 3 variables:
# $ type : chr "EA1UBL" "EA2.0UBL" "EA2.1UBL" "SBUSP14" ...
# $ class: Factor w/ 6 levels "RPT1-Y249","RPT2-Y259",..: 1 1 1 1 1 1 1 2 2 2 ...
# $ value: num 37.3 36.5 37 36.9 38.1 38.9 53.5 34.6 32.9 33.3 ...
ggplot(fig7.h, aes(type, value, group = class, color = class, fill = class, shape = class)) +
geom_line(size = 1) +
geom_point(size = 3) +
scale_y_continuous(breaks = seq(20, 60, 10), limits = c(20, 60)) +
theme_classic() +
guides(fill = guide_legend(title = NULL),
shape = guide_legend(title = NULL),
color = guide_legend(title = NULL)) +
theme(legend.position = "top", #图例上方
legend.text = element_text(size = 12),
legend.key.height = unit(1, "cm"),
axis.ticks.length = unit(0.3, "cm"),
axis.line = element_line(size = 1),
axis.title.x = element_blank(),
legend.title = element_blank(),
axis.title.y = element_text(size = 12),
axis.text = element_text(size = 12),
axis.text.x = element_text(angle = 45, hjust = 1)) +
scale_color_manual(values = c("#F14B0d", "#1D5F9B", "#B68833", "#842A82", "#B079BA", "#000000")) +
scale_fill_manual(values = c("#F14B0d", "#1D5F9B", "#B68833", "#842A82", "#B079BA", "#000000")) +
scale_shape_manual(values = c(19,24,25,23,22,8)) +
labs(y = "Distance of pore 1 loop to CP(A)") +
guides(color = guide_legend(byrow = TRUE),
fill = guide_legend(byrow = TRUE),
shape = guide_legend(byrow = TRUE))
![](https://oss-emcsprod-public.modb.pro/wechatSpider/modb_20221009_6aaa4eb0-477e-11ed-a381-fa163eb4f6be.png)
该图绘图形式较为简洁,所使用的基本绘图函数为geom_line() 函数与geom_point() 函数。需要注意的是,为每条折线设置不同的颜色及点的形状,需要用到scale_color_manual() 函数、scale_fill_manual() 函数以及scale_shape_manual() 函数,此外,图例内元素的排列顺序,需要用到byrow参数。
2、其他
其他绘图方法可进一步阅读公众号其他文章。
如有帮助请多多点赞哦!
参考资料
Zhang, S., Zou, S., Yin, D. et al. USP14-regulated allostery of the human proteasome by time-resolved cryo-EM. Nature 605, 567–574 (2022). : https://doi.org/10.1038/s41586-022-04671-8
文章转载自日常分享的小懒猫,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。