'How to display all values on X and Y axes in R ggplot2 [duplicate]

In ggplot2 I want to display

(1) all the values in x-axis 1,2,....,15

(2) raw number instead of the scientific notation

enter image description here

Below is my code

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

Please share your full code

Thanx in advance



Solution 1:[1]

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)

Created on 2022-04-29 by the reprex package (v2.0.1)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 YH Jang