r语言导入ggplot2,如何使用ggplot2在R中添加r ^ 2值图?

I am new to r but am using it for a project in which I wish to represent 3 different y values with same x value on the same scatteplot including linear regression lines for each along with the value. I don't know if what I have done so far is the best but:

leafdata.long

ggplot(leafdata.long, aes(Percent.Area.Loss, value, color=variable))+

geom_point()+geom_smooth(method=lm, se=FALSE)+opts(title="Compiled Leaf Data")

Here's the plot that it produced:

http://imgur.com/eXNFY5d

Any help with changing the x and y labels along with the legend would be appreciated also. I'm very much lost.

解决方案

The above link seems to do this way nicer. However, since I already had this done by the time I saw the post above I figured I'd post anyways.

library(plyr)

d

r2

names(r2)

g

g

g+geom_text(data=r2,aes(color=cat, label = paste("R^2: ", r2,sep="")),parse=T,x=100,y=c(1,1.25,1.5), show_guide=F)

881c018dd09d06e7a28e831c9e69614d.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值