前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >一键搞定全部统计绘图!这个可视化工具太赞了!!

一键搞定全部统计绘图!这个可视化工具太赞了!!

作者头像
DataCharm
发布2022-05-24 16:09:48
6750
发布2022-05-24 16:09:48
举报
文章被收录于专栏:数据 学术 商业 新闻

小伙伴们非要私信要R语言的统计可视化工具,推给你~~

今日小编继续给大家推荐优质绘图工具,帮助小伙伴们更好的是实现不同领域中可视化作品的快速绘制。今天的主角为R-grafify包,其包含5大类共19种可视化图表,舒适和符合出版要求的配色更是为这个可视化包填色,下面就通过以下两个方面介绍下整个优质可视化工具。

  • R-grafify介绍
  • R-grafify样例介绍

R-grafify介绍

这一部分小编重点放在R-grafify可绘制的5大类可视化图表和颜色搭配上,内容如下:

5大类可视化图表

R-grafify包可绘制的19种图表主要可分为以下5个小类:

  • Two variables、
  • Three or four variables、
  • Numeric X-Y Plots、
  • Before-after Plots
  • Data distributions

下面的样例介绍部分,小编将进行具体介绍。

颜色搭配

R-grafify 包有其自己独有的颜色搭配设计,这里直接列出其所有的颜色条,如下图所示:

R-grafify包所能使用的颜色条示例

你可以像使用ggplot2种的scale_fill... 和scale_colour... 函数一样使用R-grafify包的颜色名称进行颜色选择和设置。

R-grafify样例介绍

这一部分小编将对上述列举过的5大类图表进行一一介绍(有的类样例较多,将介绍几个典型的图表类型),详细内容如下:

Two variables

这一小类所含图表类型较多,这里小编简单列举3个样例,如下:

  • plot_scatterbar_sd()
代码语言:javascript
复制
plot_scatterbar_sd(data = data_1w_death, #data table
                             xcol = Genotype,      #X variable
                             ycol = Death)+        #Y variable
  hrbrthemes::theme_ipsum(base_family = "Roboto Condensed") +
  labs(
    title = "Example of <span style='color:#D20F26'>grafify::plot_scatterbar_sd function</span>",
    subtitle = "processed charts with <span style='color:#1A73E8'>plot_scatterbar_sd()</span>",
    caption = "Visualization by <span style='color:#0057FF'>DataCharm</span>") +
  theme(
    plot.title = element_markdown(hjust = 0.5,vjust = .5,color = "black",
                                  size = 20, margin = margin(t = 1, b = 12)),
    plot.subtitle = element_markdown(hjust = 0,vjust = .5,size=15),
    plot.caption = element_markdown(hjust = 1,face = 'bold',size = 12))

Example Of grafify::plot_scatterbar_sd function

  • plot_scatterbox()
代码语言:javascript
复制
plot_scatterbox(data_1w_death,    #data table
            Genotype,         #X variable
            Death,            #Y variable
            symsize = 3,      #larger symbols
            jitter = 0.2)

Example Of grafify::plot_scatterbox()

  • plot_point_sd()
代码语言:javascript
复制
plot_point_sd(data_1w_death,
            Genotype,
            Death,
            symsize = 6,     #larger symbols
            ewid = 0.2,      #narrower error bars
            ColPal = "bright", #"bright" palette
            ColRev = F) +

Example Of grafify::plot_point_sd()

「注意」:这里更改了颜色条:ColPal = "bright",且ColRev设置成False。

Three or four variables

这类图表包含plot_3d_scatterbar(), plot_3d_scatterbox(), plot_4d_scatterbar(), plot_4d_scatterbox() 函数,具体如下:

  • plot_3d_scatterbar()
代码语言:javascript
复制
plot_3d_scatterbar(data_2w_Festing,     #data table
                   Strain,           #X variable
                   GST,                 #Y variable
                   shapes = Treatment, 
                   symsize = 3,         #grouping factor for shapes
                   ColPal = "vibrant") + #"vibrant" palette
hrbrthemes::theme_ipsum(base_family = "Roboto Condensed") +
  labs(
    title = "Example of <span style='color:#D20F26'>grafify::plot_3d_scatterbar function</span>",
    subtitle = "processed charts with <span style='color:#1A73E8'>plot_3d_scatterbar()</span>",
    caption = "Visualization by <span style='color:#0057FF'>DataCharm</span>") +
  theme(
    plot.title = element_markdown(hjust = 0.5,vjust = .5,color = "black",
                                  size = 20, margin = margin(t = 1, b = 12)),
    plot.subtitle = element_markdown(hjust = 0,vjust = .5,size=15),
    plot.caption = element_markdown(hjust = 1,face = 'bold',size = 12))

Example Of grafify::plot_3d_scatterbar()

  • plot_3d_scatterbox()
代码语言:javascript
复制
plot_3d_scatterbox(data_2w_Tdeath,
                   Time, 
                   PI,
                   Genotype,
                   b_alpha = 0.5,          #reduced opacity
                   ColPal = "contrast",  #"contrast" palette
                   ColRev = T)

Example Of grafify::plot_3d_scatterbox()

  • plot_4d_scatterbar()
代码语言:javascript
复制
plot_4d_scatterbar(data_2w_Tdeath, 
                   Time, 
                   PI,
                   Genotype,
                   Experiment,
                   b_alpha = 0.7,
                   ColPal = "okabe_ito")+
  scale_colour_manual(values = c("black", "grey20"))

Example Of grafify::plot_4d_scatterbar()

  • plot_4d_scatterbox()
代码语言:javascript
复制
plot_4d_scatterbox(data_2w_Tdeath, 
                   Time, 
                   PI,
                   Genotype,
                   Experiment,
                   b_alpha = 0.7,
                   ColPal = "okabe_ito")+
  scale_colour_manual(values = c("black", "grey20"))  #manual colour scale

Example Of grafify::plot_4d_scatterbox()

Numeric X-Y Plots

此类图表包含plot_xy_NumGroup(), plot_xy_CatGroup() 函数,具体如下:

  • plot_xy_NumGroup()
代码语言:javascript
复制
plot_xy_NumGroup(airquality, 
                 Wind, 
                 Temp, 
                 Ozone,
                 symsize = 3)

Example Of grafify::plot_xy_NumGroup()

  • plot_xy_CatGroup()
代码语言:javascript
复制
plot_xy_CatGroup(neuralgia,
                 Age,
                 Duration,
                 Pain,
                 symsize = 3,
                 ColPal = "muted",     #palette
                 ColRev = T)

Example Of grafify::plot_xy_CatGroup()

Before-after Plots

此类图表包含plot_befafter_colours() , plot_befafter_shapes() 函数,具体如下:

  • plot_befafter_colours()
代码语言:javascript
复制
plot_befafter_colours(data = data_t_pdiff,
                      xcol = Condition,
                      ycol = Mass,
                      groups = Subject,
                      symsize = 5,
                      ColPal = "light",
                      ColRev = T)

Example Of grafify::plot_befafter_colours()

Data distributions

此类图表包含plot_qqline(), plot_density() 和plot_histogram() 函数,具体如下:

  • lot_qqline()
代码语言:javascript
复制
plot_qqline(data = data_t_pratio, 
            ycol = Cytokine,
            xcol = Genotype)

Example Of grafify::plot_qqline()

以上就是小编关于R-grafify包的简单介绍,特别是对每种绘图函数所需数据的数据形式理解。更多关于该包参数和使用方法等介绍可参考R-grafify包官网[1]

总结

今天的推文小编简单介绍了R-grafify包的各种图表类型和颜色搭配,希望感兴趣的小伙伴可以进行相关科研图表 的绘制和对其颜色搭配 的参考~~

参考资料

[1]

R-grafify包官网: https://grafify-vignettes.netlify.app/。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2022-05-19,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 DataCharm 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • R-grafify介绍
    • 5大类可视化图表
      • 颜色搭配
      • R-grafify样例介绍
        • Two variables
          • Three or four variables
            • Numeric X-Y Plots
              • Before-after Plots
                • Data distributions
                • 总结
                  • 参考资料
                  领券
                  问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档