Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

In ggplot2 I want to display

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

(2) raw number instead of the scientific notation

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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 :

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)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading