I am using ggplot library to make MAPLOT, where I want x-axis to have scale as 1,100,10000
My data looks like this(few lines)
gene baseMean log2FoldChange lfcSE stat pvalue padj genename threshold
ENSG00000223972 0.575771350800225 0.0412219472008923 3.00480558248345 0.0137186736610169 0.989054425422109 NA DDX11L1 non_sig
ENSG00000227232 638.915585716581 0.0759771312187909 0.265826656683689 0.285814568661551 0.77502014921445 0.925602441205682 WASH7P non_sig
ENSG00000238009 0.732676980883345 1.70580495308195 2.88536344691496 0.591192404168632 0.554391511600533 NA RP11-34P13.7 sig
ENSG00000233750 0.665119914806497 1.43662798114606 2.40334694948042 0.597761376673745 0.549999165399301 NA CICP27 non_sig
ENSG00000237683 1.61059299708066 1.32385867730769 1.59103144187764 0.832075748135656 0.405366189814378 NA AL627309.1 non_sig
ENSG00000268903 0.53805903280028 1.11220672347871 3.09943388409949 0.358841893413014 0.719713370602976 NA RP11-34P13.15 non_sig
ENSG00000241860 6.36716721142452 1.00072051754609 0.952066011135871 1.0511041312694 0.293210766884749 0.62978967383262 RP11-34P13.13 non_sig
ENSG00000228463 3.16284935240728 2.539009793132 1.21049386749042 2.09749909629516 0.0359494170864793 0.184551759280715 AP006222.2 non_sig
ENSG00000237094 3.57505447485535 -0.402759405190994 0.989965477248915 -0.406841869183409 0.684124133143038 0.887865190354194 RP4-669L17.10 non_sig
I used the following R code:
df <- read.table("test.txt",header=TRUE,sep="\t")
ggplot(df,aes(x=baseMean,y=log2FoldChange)) + geom_point(aes(col=threshold),size=1,shape=20) + ylim(-15,15)+
scale_color_manual(values=c("gray70", "red"), name="threshold")+
scale_x_continuous(trans = 'log10') + geom_hline(yintercept = 0,linetype="dashed",color="red")+ xlab("mean of normalized counts")+
ggtitle("MAPLOT")+theme_classic()
When I use log10 in scale_x_continuous as argument I get 10,1000,100000 as labels on x axis. Is there a way I can get 1,100,10000 as x-axis?
Thanks
breaks
inscale_x_continuous()
. – aosmith