❝本节来介绍一款使用自然语言来调整R代码进行图形绘制的R包「ggx」,其主要作用是通过自然语言来调整代码此外还可以作为代码提示器使用。感觉挺有趣的,更多详细内容请参考作者官方文档。
❞
❝https://github.com/brandmaier/ggx
❞
install.packages("ggx")
library(ggx)
library(tidyverse)
ggplot(data=iris,
mapping=aes(x=Sepal.Length,
y=Petal.Length, color=Species))+
geom_point()
ggplot(data=iris,
mapping=aes(x=Sepal.Length,
y=Petal.Length, color=Species))+
geom_point()+
gg_("hide legend")
ggplot(data=iris,
mapping=aes(x=Sepal.Length,
y=Petal.Length, color=Species))+
geom_point()+
gg_("rotate x-axis labels by 90°")+
gg_("set x-axis label to 'Length of Sepal'")
ggplot(data=iris,
mapping=aes(x=Sepal.Length,
y=Petal.Length, color=Species))+
geom_point()+
gg_("double the font size on the x-axis label")
ggplot(data=iris,
mapping=aes(x=Sepal.Length,
y=Petal.Length, color=Species))+
geom_point()+
gg_("add 'Hello World' as plot title")+
gg_("paint the plot title in a beautiful orange")+
gg_("set the color of the x-axis label to blue")
❝可以看到ggx可以用自然语言的写法来调整代码,除此之外ggx还可以作为提示工具来提供对应的帮助代码,如下所示。
❞
gghelp("I want to remove my plot legend")
#> theme(legend.position = "none")
gghelp("Please hide the legend")
#> theme(legend.position = "none")
gghelp("Get rid of that stupid legend")
#> theme(legend.position = "none")
❝有需要学习个性化数据可视化的朋友,欢迎到小编的「淘宝店铺」 「R语言数据分析指南」购买「2023年度会员文档」同步更新中
❞初始价格99元
6月后将调整价格为「149元」,内容主要包括各种「高分论文的图表分析复现以及一些个性化图表的绘制」均包含数据+代码;按照往年数据小编年产出约在150+以上
购买后微信发小编订单截图即邀请进新的会员交流群,小编的文档为按年售卖,只包含当年度的「除系列课程外」的文档,有需要往年文档的朋友也可下单购买,需要了解更多信息的朋友欢迎交流咨询。
微信扫一扫
关注该公众号