【R包】tidyplots----取代ggplot2的科研绘图利器

文章目录

介绍

tidyplots----取代ggplot2的科研绘图利器。tidyplots的目标是简化为科学论文准备出版的情节的创建。它允许使用一致和直观的语法逐渐添加,删除和调整情节组件。

安装

You can install the released version of tidyplots from CRAN with:

r 复制代码
install.packages("tidyplots")

And the development version from GitHub with:

r 复制代码
# install.packages("devtools")
devtools::install_github("jbengler/tidyplots")

Usage

Here are some examples. Also have a look at the getting started guide and the full documentation.

r 复制代码
library(tidyplots)

study |> 
  tidyplot(x = treatment, y = score, color = treatment) |> 
  add_mean_bar(alpha = 0.4) |> 
  add_sem_errorbar() |> 
  add_data_points_beeswarm()
r 复制代码
energy |> 
  tidyplot(x = year, y = energy, color = energy_source) |> 
  add_barstack_absolute()
r 复制代码
energy |> 
  dplyr::filter(year %in% c(2005, 2010, 2015, 2020)) |> 
  tidyplot(y = energy, color = energy_source) |> 
  add_donut() |> 
  split_plot(by = year)
r 复制代码
energy_week |> 
  tidyplot(x = date, y = power, color = energy_source) |> 
  add_areastack_absolute()
r 复制代码
energy_week |> 
  tidyplot(x = date, y = power, color = energy_source) |> 
  add_areastack_relative()
r 复制代码
study |> 
  tidyplot(x = group, y = score, color = dose) |> 
  add_mean_bar(alpha = 0.4) |> 
  add_mean_dash() |> 
  add_mean_value()
r 复制代码
time_course |>
  tidyplot(x = day, y = score, color = treatment) |>
  add_mean_line() |>
  add_mean_dot() |>
  add_sem_ribbon()
r 复制代码
climate |>
  tidyplot(x = month, y = year, color = max_temperature) |>
  add_heatmap()
r 复制代码
study |> 
  tidyplot(x = treatment, y = score, color = treatment) |> 
  add_boxplot() |> 
  add_test_pvalue(ref.group = 1)
r 复制代码
gene_expression |> 
  dplyr::filter(external_gene_name %in% c("Apol6", "Col5a3", "Vgf", "Bsn")) |> 
  tidyplot(x = condition, y = expression, color = sample_type) |> 
  add_mean_dash() |> 
  add_sem_errorbar() |> 
  add_data_points_beeswarm() |> 
  add_test_asterisks(hide_info = TRUE) |> 
  remove_x_axis_title() |> 
  split_plot(by = external_gene_name)
r 复制代码
study |> 
  tidyplot(x = treatment, y = score, color = treatment) |> 
  add_mean_bar(alpha = 0.4) |> 
  add_sem_errorbar() |> 
  add_data_points_beeswarm() |> 
  view_plot(title = "Default color scheme: 'friendly'") |> 
  adjust_colors(colors_discrete_apple) |> 
  view_plot(title = "Alternative color scheme: 'apple'")

文档

参考

相关推荐
数据科学项目实践15 小时前
Matplotlib 简单教程 3:坐标轴\边框设置
数据可视化
Tiger Z17 小时前
《R for Data Science (2e)》免费中文翻译 (第12章) --- Logical vectors(1)
数据分析·r语言·数据科学·免费书籍
AI纪元故事会1 天前
《目标检测全解析:从R-CNN到DETR,六大经典模型深度对比与实战指南》
人工智能·yolo·目标检测·r语言·cnn
IT小哥哥呀3 天前
Python实用技巧:批量处理Excel数据并生成销售报表(含实战案例)
python·pandas·数据可视化·数据处理·报表生成·excel自动化·办公神器
小八四爱吃甜食3 天前
【R语言】构建GO、KEGG相关不同物种的R包
开发语言·golang·r语言
梦想的初衷~3 天前
生命周期评价(LCA):理论、方法与工具、典型案例全解析
r语言·农业·林业·环境科学·地理·气候变化·生命周期评价
asyxchenchong8884 天前
OpenLCA、GREET、R语言的生命周期评价方法、模型构建
开发语言·r语言
没有梦想的咸鱼185-1037-16634 天前
【生命周期评价(LCA)】基于OpenLCA、GREET、R语言的生命周期评价方法、模型构建
开发语言·数据分析·r语言
大飞码农4 天前
📊 开源了一个 Git 代码统计神器,解决了团队代码量统计的 N 个痛点
git·数据可视化
zhangfeng11335 天前
亲测有效的mem 流行病预测,时间序列预测,r语言做移动流行区间法,MEM流行病阈值设置指南
开发语言·r语言·生物信息