R包:‘ggcharts好看线图包‘-Charts

各种线图

data("revenue_wide")

line_chart(data = revenue_wide, x = year, y = Roche:Bayer) +
  labs(x = "Year", y = "Revenue (Billion USD)")

在这里插入图片描述

biomedicalrevenue %>%
  filter(year == 2018) %>%
  lollipop_chart(x = company, y = revenue, threshold = 30) +
  labs(
    x = NULL,
    y = "Revenue",
    title = "Biomedical Companies with Revenue > $30Bn."
  ) +
  scale_y_continuous(
    labels = function(x) paste0("$", x, "Bn."),
    expand = expansion(mult = c(0, .05))
  )

在这里插入图片描述

data("popeurope")
dumbbell_chart(
  data = popeurope,
  x = country,
  y1 = pop1952,
  y2 = pop2007,
  top_n = 10,
  point_colors = c("lightgray", "#494F5C")
) +
  labs(
    x = NULL,
    y = "Population",
    title = "Europe's Largest Countries by Population in 2007"
  ) +
  scale_y_continuous(
    limits = c(0, NA),
    labels = function(x) paste(x, "Mn.")
  )

在这里插入图片描述

data(mtcars)
mtcars_z <- dplyr::transmute(
  .data = mtcars,
  model = row.names(mtcars),
  hpz = scale(hp)
)

diverging_bar_chart(data = mtcars_z, x = model, y = hpz)

在这里插入图片描述

diverging_lollipop_chart(
  data = mtcars_z,
  x = model,
  y = hpz,
  lollipop_colors = c("#006400", "#b32134"),
  text_color = c("#006400", "#b32134")
)

在这里插入图片描述

data("popch")
pyramid_chart(data = popch, x = age, y = pop, group = sex)

在这里插入图片描述

上一篇:python线程安全日志处理模块


下一篇:Golang | Leetcode Golang题解之第229题多数元素II-题解: