R基础绘图学习笔记(一)
来源:互联网 发布:js变量为undefined 编辑:程序博客网 时间:2024/06/05 02:05
了解绘图
1.散点图
plot(cars$dist~cars$speed, # y~x main="Relationship between car distance &speedr", #散点图标题 xlab="Speed (miles per hour)", #X轴标题 ylab="Distance travelled (miles)", #Y轴标题 xlim=c(0,30), #坐标轴表示范围 ylim=c(0,140), yaxs="r", # col="red", #设置颜色红色 pch=19) #设置符号
plot(cars$dist~cars$speed)
2.画线图
代码实现:
plot(sales$units~as.Date(sales$date,"%d/%m/%y"), type="l", #Specify type of plot as l for line main="Unit Sales in the month of January 2010", xlab="Date", ylab="Number of units sold", col="blue")lines(sales$units~as.Date(sales$date,"%d/%m/%y"), col="red")
3.条形图
代码如下:
#Vertical barsbarplot(sales$ProductA, names.arg= sales$City, col="black")#Horizontal barsbarplot(sales$ProductA, names.arg= sales$City, horiz=TRUE, col="black")#Grouped bars with legendbarplot(as.matrix(sales[,2:4]), beside= TRUE, legend=sales$City, col=heat.colors(5), border="white")#Horizontal grouped bars with legendbarplot(as.matrix(sales[,2:4]), beside=TRUE, legend=sales$City, col=heat.colors(5), border="white", horiz=TRUE)
直方图和密度图
代码如下:
hist(rnorm(1000)) hist(islands) plot(density(rnorm(1000)))
箱线图
代码如下
boxplot(copper$Cu~copper$Source, xlab="Measurement Site", ylab="Atmospheric Concentration of Copper in ng per cubic metre", main="Atmospheric Copper Concentrations in London")boxplot(metals, xlab="Metals", ylab="Atmospheric Concentration in ng per cubic metre", main="Atmospheric Metal Concentrations in London")
热图,地图
代码如下:
heatmap(as.matrix(mtcars), Rowv=NA, Colv=NA, col = heat.colors(256), scale="column", margins=c(2,8), main = "Car characteristics by Model")image(x=1:ncol( genes), y=1:nrow(genes), z=t(as.matrix(genes)), axes=FALSE, xlab="", ylab="" , main="Gene Correlation Matrix")axis(1,at=1:ncol(genes),labels=colnames(genes),col="white",las=2,cex.axis=0.8) axis(2,at=1:nrow(genes),labels=rownames(genes),col="white",las=1,cex.axis=0.8)map('world', fill = TRUE,col=heat.colors(10))
emmm
pairs(iris[,1:4])plot(iris[,1:4],main="Relationships between characteristics of iris flowers",pch=19,col="blue",cex=0.9)
阅读全文
1 0
- R基础绘图学习笔记(一)
- R基础绘图学习笔记(二)
- R笔记(绘图)
- R软件学习笔记-5(R语言绘图)
- R语言绘图学习笔记
- 计算机绘图 学习笔记(一)
- OpenCV学习笔记(一):绘图操作
- 绘图与动画学习笔记(一)
- matlab学习笔记(一)---二维绘图
- R语言学习笔记-绘图相关
- R语言学习笔记(3):绘图
- R语言学习笔记之绘图篇
- R语言学习笔记——R语言绘图
- R--绘图基础
- R语言绘图基础
- R 基础绘图note
- r语言基础绘图
- R基础绘图
- 第十七天
- 继承和派生
- Scala入门学习之【类,对象,继承】
- 160. Intersection of Two Linked Lists
- 安装ORACLE10.2.0.1.0,然后升级到10.2.0.4.0,然后恢复数据库(在RAC ASM文件系统恢复到单机文件系统)(实战)
- R基础绘图学习笔记(一)
- 【C++】STL的重写
- OpenLTE安装
- 关于Keil 的快速注释功能,并为其添加快捷键
- codeforces 816B
- 无线mesh网络路由协议分类
- python 学习笔记2 --画图(networkx)
- SSM框架中注解含义及应用场景小结
- n皇后解法