Question: can not transpose ggplot2 smooth line
0
gravatar for mbk0asis
4.0 years ago by
mbk0asis460
Korea, Republic Of
mbk0asis460 wrote:

Hi,

I was trying to draw scatter plots with smooth lines using ggplot2. When I transpose X/Y axis (data), the smooth line didn't.

I thought smooth lines were to show the trend of data. Am I misunderstanding? 

When I changed below

p <- qplot(log2(countsNormalized[,1]+1),log2(countsNormalized[,4]+1),xlab="A", ylab="B",alpha=0.9)
p + geom_smooth(method="lm",se=F) + geom_abline(intercept = 0,linetype="dotted") + geom_point(size=3) + stat_smooth_func(geom="text",method="lm",hjust=0,parse=TRUE)

to next

p <- qplot(log2(countsNormalized[,4]+1),log2(countsNormalized[,1]+1),xlab="A", ylab="B",alpha=0.9)
p + geom_smooth(method="lm",se=F) + geom_abline(intercept = 0,linetype="dotted") + geom_point(size=3) + stat_smooth_func(geom="text",method="lm",hjust=0,parse=TRUE)

the smooth line stayed the same.

Any ideas would be helpful. Thanks.

 

rna-seq ggplot2 R • 1.3k views
ADD COMMENTlink modified 4.0 years ago by Daniel3.7k • written 4.0 years ago by mbk0asis460

By the way, how can I put picture here?

ADD REPLYlink written 4.0 years ago by mbk0asis460
3
gravatar for Daniel
4.0 years ago by
Daniel3.7k
Cardiff University
Daniel3.7k wrote:

Instead of swapping the axes around in the columns, you can just use + coord_flip().

Check out: http://docs.ggplot2.org/0.9.3.1/coord_flip.html for implementations.

ADD COMMENTlink modified 4.0 years ago • written 4.0 years ago by Daniel3.7k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1576 users visited in the last hour