gpt4 book ai didi

r - 增加 y 轴刻度标签 ggplot2 上的间距

转载 作者:行者123 更新时间:2023-12-05 07:43:37 29 4
gpt4 key购买 nike

<分区>

我想增加 y 轴刻度的间距,以使图表(标签)更具可读性。我怎样才能做到这一点?

packages_list <- c("dplyr", "data.table", "ggplot2", "mondate", "tidyr", 
"lubridate", "stringr", "ggrepel")
lapply(packages_list, require, character.only = TRUE)

company <- paste(1:61, rep(LETTERS), sep = "")
mort_table <- rep_len(c(6065, 7680, 8590, 9500), length.out = 61)
disc_rate <- rep_len(c(3,4), length.out = 61)

data <- data_frame(company = company, disc_rate = disc_rate, mort_table =
mort_table)
ggplot(data, aes(x = company, y= disc_rate, label = disc_rate)) +
geom_point(aes(color = factor(mort_table)), size = 6, show.legend = T) +
geom_text(color = "white", size = 1.5) +
geom_hline(yintercept=3.5, size=1, linetype="dotted", color="red") +
theme(panel.grid.major.x = element_line(), legend.position = "top") +
coord_flip()

enter image description here

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com