可视化也需要赛博朋克

2021-03-05  本文已影响0人  R语言数据分析指南

分享R中创建CyberPunk的小例子,喜欢的小伙伴可以关注我的公众号R语言数据分析指南,持续分享更多优质资源

devtools::install_github("delabj/ggCyberPunk")
library(tidyverse)
library(ggCyberPunk)

geom_glowing_area()

赛博朋克/迪斯科/霓虹灯氛围的发光区域图

geom_glowing_area(alpha = 1, size= 1,glow_alpha = 0.03)

alpha:基线的Alpha级别:基线的size大小 glow_alpha:设置发光层的Alpha级别

例子1

df = data.frame(A=c(1,4,4,6,7,5,1),
                B=c(4,3,5,7,5,6,7),
                Time=c(1,2,3,4,5,6,7)) %>%
  pivot_longer(cols = c(A,B),names_to = "group", values_to = "count")

df %>%
  ggplot(aes(x=Time, y = count, color = group, fill= group))+
  geom_glowing_area()+
  theme_cyberpunk()+
  scale_fill_cyberpunk("zune")+
  scale_color_cyberpunk("zune")+
  ggtitle("geom_glowing_area()", subtitle = "From ggCyberPunk")

例子2

df = data.frame(A=c(1,4,4,6,7,5,1),
                B=c(4,3,5,7,5,6,7),
                Time=c(1,2,3,4,5,6,7)) %>%
  pivot_longer(cols = c(A,B),names_to = "group", values_to = "count")


df %>%
  ggplot(aes(x=Time, y = count, color = group, fill= group))+
  geom_glowing_line()+
  theme_cyberpunk()+
  scale_color_cyberpunk()+
  ggtitle("geom_glowing_line()", subtitle = "From ggCyberPunk")

例子3

df = data.frame(A=c(1,4,4,6,7,5,1),
                B=c(4,3,5,7,5,6,7),
                Time=c(1,2,3,4,5,6,7)) %>%
  pivot_longer(cols = c(A,B),names_to = "group", values_to = "count")


df %>%
  ggplot(aes(x=Time, y = count, color = group, fill= group))+
  geom_linesaber()+
  theme_cyberpunk()+
  scale_color_cyberpunk()+
  ggtitle("geom_linesaber()", subtitle = "From ggCyberPunk")

原文链接:https://mp.weixin.qq.com/s/_JyjH0rOUUEcwhvAFKW2Xg

上一篇下一篇

猜你喜欢

热点阅读