changing x axis scale using ggplot
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
r ggplot2
add a comment |
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
r ggplot2
You could try setting the x axis breaks to what you want them to be withbreaksinscale_x_continuous().
– aosmith
Nov 20 '18 at 23:04
I tried doing this scale_x_continuous(breaks=c(1,100,10000)), but the graph looks squished. I want x axis to be on log 10 scale starting with 1 and not 10
– user3138373
Nov 20 '18 at 23:07
stackoverflow.com/questions/14255533/…
– M-M
Nov 20 '18 at 23:23
add a comment |
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
r ggplot2
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
r ggplot2
r ggplot2
asked Nov 20 '18 at 22:50
user3138373user3138373
165110
165110
You could try setting the x axis breaks to what you want them to be withbreaksinscale_x_continuous().
– aosmith
Nov 20 '18 at 23:04
I tried doing this scale_x_continuous(breaks=c(1,100,10000)), but the graph looks squished. I want x axis to be on log 10 scale starting with 1 and not 10
– user3138373
Nov 20 '18 at 23:07
stackoverflow.com/questions/14255533/…
– M-M
Nov 20 '18 at 23:23
add a comment |
You could try setting the x axis breaks to what you want them to be withbreaksinscale_x_continuous().
– aosmith
Nov 20 '18 at 23:04
I tried doing this scale_x_continuous(breaks=c(1,100,10000)), but the graph looks squished. I want x axis to be on log 10 scale starting with 1 and not 10
– user3138373
Nov 20 '18 at 23:07
stackoverflow.com/questions/14255533/…
– M-M
Nov 20 '18 at 23:23
You could try setting the x axis breaks to what you want them to be with
breaks in scale_x_continuous().– aosmith
Nov 20 '18 at 23:04
You could try setting the x axis breaks to what you want them to be with
breaks in scale_x_continuous().– aosmith
Nov 20 '18 at 23:04
I tried doing this scale_x_continuous(breaks=c(1,100,10000)), but the graph looks squished. I want x axis to be on log 10 scale starting with 1 and not 10
– user3138373
Nov 20 '18 at 23:07
I tried doing this scale_x_continuous(breaks=c(1,100,10000)), but the graph looks squished. I want x axis to be on log 10 scale starting with 1 and not 10
– user3138373
Nov 20 '18 at 23:07
stackoverflow.com/questions/14255533/…
– M-M
Nov 20 '18 at 23:23
stackoverflow.com/questions/14255533/…
– M-M
Nov 20 '18 at 23:23
add a comment |
                                1 Answer
                            1
                        
active
oldest
votes
df <- read.table(text = "
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
", 
  header = TRUE)
library(ggplot2)
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", breaks = c(1, 100, 10000), limits = c(NA, 10000)) + 
  geom_hline(yintercept = 0, linetype = "dashed",color = "red") + 
  xlab("mean of normalized counts") + ggtitle("MAPLOT") + 
 theme_classic()

needed to set breaks, thanks :)
– user3138373
Nov 20 '18 at 23:14
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402774%2fchanging-x-axis-scale-using-ggplot%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
                                1 Answer
                            1
                        
active
oldest
votes
                                1 Answer
                            1
                        
active
oldest
votes
active
oldest
votes
active
oldest
votes
df <- read.table(text = "
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
", 
  header = TRUE)
library(ggplot2)
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", breaks = c(1, 100, 10000), limits = c(NA, 10000)) + 
  geom_hline(yintercept = 0, linetype = "dashed",color = "red") + 
  xlab("mean of normalized counts") + ggtitle("MAPLOT") + 
 theme_classic()

needed to set breaks, thanks :)
– user3138373
Nov 20 '18 at 23:14
add a comment |
df <- read.table(text = "
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
", 
  header = TRUE)
library(ggplot2)
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", breaks = c(1, 100, 10000), limits = c(NA, 10000)) + 
  geom_hline(yintercept = 0, linetype = "dashed",color = "red") + 
  xlab("mean of normalized counts") + ggtitle("MAPLOT") + 
 theme_classic()

needed to set breaks, thanks :)
– user3138373
Nov 20 '18 at 23:14
add a comment |
df <- read.table(text = "
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
", 
  header = TRUE)
library(ggplot2)
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", breaks = c(1, 100, 10000), limits = c(NA, 10000)) + 
  geom_hline(yintercept = 0, linetype = "dashed",color = "red") + 
  xlab("mean of normalized counts") + ggtitle("MAPLOT") + 
 theme_classic()

df <- read.table(text = "
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
", 
  header = TRUE)
library(ggplot2)
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", breaks = c(1, 100, 10000), limits = c(NA, 10000)) + 
  geom_hline(yintercept = 0, linetype = "dashed",color = "red") + 
  xlab("mean of normalized counts") + ggtitle("MAPLOT") + 
 theme_classic()

answered Nov 20 '18 at 23:09
Andrew LaversAndrew Lavers
3,0811713
3,0811713
needed to set breaks, thanks :)
– user3138373
Nov 20 '18 at 23:14
add a comment |
needed to set breaks, thanks :)
– user3138373
Nov 20 '18 at 23:14
needed to set breaks, thanks :)
– user3138373
Nov 20 '18 at 23:14
needed to set breaks, thanks :)
– user3138373
Nov 20 '18 at 23:14
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
 
But avoid …
- Asking for help, clarification, or responding to other answers.
 - Making statements based on opinion; back them up with references or personal experience.
 
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402774%2fchanging-x-axis-scale-using-ggplot%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You could try setting the x axis breaks to what you want them to be with
breaksinscale_x_continuous().– aosmith
Nov 20 '18 at 23:04
I tried doing this scale_x_continuous(breaks=c(1,100,10000)), but the graph looks squished. I want x axis to be on log 10 scale starting with 1 and not 10
– user3138373
Nov 20 '18 at 23:07
stackoverflow.com/questions/14255533/…
– M-M
Nov 20 '18 at 23:23