R语言-画散点图】的更多相关文章

plot()函数 plot(cars$dist~cars$speed,           # y~x main="XXX",                                   # 画标题 xlab="XXX",                                    #X坐标轴标题 ylab="XXX",                                    #Y坐标轴标题 xlim=c(0,30…
R语言分高水平作图函数和低水平作图函数 高水平作图函数:可以独立绘图,例如plot() 低水平作图函数:必须先运行高水平作图函数绘图,然后再加画在已有的图上面 第一种方法:plot()函数 > sales<-read.csv("dailysales.csv", header=TRUE) #读取文件和列名 > plot(sales$units~as.Date(sales$date,"%d/%m/%y"), #修改日期格式 + type="l…
假设我们现在有CC,CG,GG三种基因型及三种基因型对应的表型,我们现在想要画出不同的基因型对应表型的棒状图及误差棒.整个命令最重要的就是最后一句了,用arrows函数画误差棒.用到的R语言如下: data<-read.csv("E:/model/data.csv",sep=" ",header=T)#导入数据data mean_CC<-mean(data[,1])#计算CC基因型对应的表型的平均值 mean_GG<-mean(data[,2])…
现在项目需要R语言做几个线性拟合,画一些点图,突然需要画误差线,网上找了下,可以用代码实现..效果如下 xx1<-c(xxxxxx,xxxx,xxxxx) yy1<-c(xxxxxx,xxxx,xxxxx) std1<-c(xxxxxx,xxxx,xxxxx) std2<-c(xxxxxx,xxxx,xxxxx) plot_stdy <- function(x, y, sd, len = 1, col = "black") { len <- len…
一个简单的例子: > plot(cars$dist~cars$speed,+ main="车位移与速度的关系",+ xlab="速度",+ ylab="位移",+ xlim=c(0,25),+ ylim=c(0,100), + cex=1, + col="red",+ pch=19) 运行结果如图: 参数如下,具体使用方法见上面示例 main:图形标题 sub:子标题 xlab:x轴标题 ylab:y轴标题 xlim:x…
1.在linux中安装好R 2.准备好画曼哈顿图的R脚本即manhattan.r,manhattan.r内容如下: #!/usr/bin/Rscript #example : Rscript plot_manhatom.r XXX.assoc XXX.pdf argv <- commandArgs() #define the function to plot the manhatton and quantitle-quantitle plot plot_manhatton<-function(…
type参数用来控制所生成散点图的类型,有如下几个选项: type=“p”表示绘制单独的点 type=“l”表示绘制点连成的折线 type=“b”表示有线连接的点 type=“o”表示将点绘在线上 type=“h”表示从点到x轴的垂线 type=“s”表示阶梯式图 type=“n”表示不绘制图 区别如下图:…
本文以1950年到2010年期间我国的火灾统计数据为例,数据如下所示: (0)加载数据 data<-read.csv("E:\\MyDocument\\p\\Data\\1950~2010火灾情况.csv") x=t(data[1]) y=t(data[2]) z=t(data[3]) w=t(data[4]) maxy=max(y) maxz=max(z)  maxw=max(w) (1)将火灾数.直接损失.死伤人数,分别按年份作图 plot(x,y,type="o&…
1.用qplot(x,data=data,geom.=”bar”,weight=y)+scale_y_continuous("y")画出y关于x的条形. 图中提示binwidth这里是指矩形的宽度,指定之后如下 qplot(x,data=data,geom="bar",weight=y,binwidth=0.2)+scale_y_continuous("y") 2.用qplot(x,data=data,geom.=”bar”)画出来的是频率直方图…
install.packages('wordcloud') library(wordcloud) colors=c('red','blue','green','yellow','purple') data=read.csv("data.csv") wordcloud(data$words, data$freq, scale=c(10,0.5),min.freq=-Inf,max.words=Inf,colors=colors,random.order=F,random.color=F,…