Entering edit mode
3.5 years ago
salman_96
▴
70
Hi I have made a plot with Chromosomes on x axis and P values on y-axis. On x axis I get all 20 chromosomes that were in the analysis but I want the x axis size to increase to 23 total.
ggplot(Results, aes(x = factor(Chromosomes), y = P-value)) +
geom_point() +
theme(axis.text.x = element_text(angle = 90) + xlab("Chromosome")+ ylab("P-value") +labs(title=
"Results_analysis" ,y="P-value", x = "Chromosomes")
regards
This is not reproducible. Please provide example data, e.g. via
dput
.check the documentation here: https://ggplot2.tidyverse.org/reference/lims.html
Try making a vector with all the chromosome formatted the way you want, e.g.
all_chroms <- c("chr1", "chr2", "chr3", .. , "chrX", "chrY")
And then use this as the variable
levels
infactor()
, so:ggplot(Results, aes(x = factor(Chromosome, levels = all_chroms), y = P-value))
.. etc