如何在 R ggplot2 中显示 X 轴和 Y 轴上的所有值

How to display all values on X and Y axes in R ggplot2

我想在ggplot2中显示

(1) x轴1,2,....,15

的所有值

(2) 原始数而不是科学记数法

下面是我的代码

cycle_time <- 1:15
volume <- c(109.12,381.11,812.31,1109,4439.32, 12148.29,32514.32,82231.24,183348.44,329472.36,462381.96,541111.67,
            576516.09, 590450.40,595642.83)

dfx <- data.frame(as.factor(cycle_time),volume)

p1<- ggplot(dfx, aes(cycle_time,volume)) + geom_line()
p1

请分享您的完整代码

提前致谢

cycle_time <- 1:15
volume <- c(109.12,381.11,812.31,1109,4439.32, 12148.29,32514.32,82231.24,183348.44,329472.36,462381.96,541111.67,
            576516.09, 590450.40,595642.83)

dfx <- data.frame(cycle_time,volume)

p1<- ggplot(dfx, aes(cycle_time,volume)) + geom_line()
p1 +
  scale_x_continuous(breaks=seq(1,15,1))+
  scale_y_continuous(labels=scales::comma)

reprex package (v2.0.1)

于 2022-04-29 创建