R语言-画柱形图】的更多相关文章

barplot()函数 1.柱形图 > sales<-read.csv("citysales.csv",header=TRUE) #读取数据 > barplot(sales$ProductA,names.arg=sales$City, #设置Y轴,X轴 +col="black") #设置颜色 结果如下图: 2.水平柱形图 > sales<-read.csv("citysales.csv",header=TRUE) #…
假设我们现在有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…
R语言分高水平作图函数和低水平作图函数 高水平作图函数:可以独立绘图,例如plot() 低水平作图函数:必须先运行高水平作图函数绘图,然后再加画在已有的图上面 第一种方法:plot()函数 > sales<-read.csv("dailysales.csv", header=TRUE) #读取文件和列名 > plot(sales$units~as.Date(sales$date,"%d/%m/%y"), #修改日期格式 + type="l…
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(…
plot()函数 plot(cars$dist~cars$speed,           # y~x main="XXX",                                   # 画标题 xlab="XXX",                                    #X坐标轴标题 ylab="XXX",                                    #Y坐标轴标题 xlim=c(0,30…
本文以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,…
正弦曲线一个周期是2π,我们要先生成x的取值范围. 可以用seq函数生成一个等差序列,步进为0.01 x=seq( 0,  2*pi,  0.01 )   pi表示π y=sin(x) plot(x,y,type='l')         type='l'表示图形显示为线段,line…