-
生成图形的途径 dev.off()关闭图形设备 dev.cur()当前活跃的图形设备 dev.set()将指定设备设置为活跃的图形设备 拷贝图形查看全部
-
图形设备查看全部
-
pal <- colorRamp(c("red","blue")) pal(0)#red pal(1)#blue pal(0.5) pal(seq(0,1,len=10)) pal <- colorRampPalette(c("red","yellow")) pal(1) pal(2) pal(10) library(RColorBrewer) brewer.pal.info cols <- brewer.pal(3,"Greens") pal <- colorRampPalette(cols) image(volcano,col=pal(20)) display.brewer.pal(3,"Greens")查看全部
-
R语言绘图之颜色 grDevice包:colorRamp()&colorRampPalette() RColorBrewer包查看全部
-
library(RColorBrewer) myColor <- c(brewer.pal(5,"Dark2"),"black") display.brewer.pal(5,"Dark2") ggplot(airquality,aes(Wind,Temp,col=factor(Month)))+ geom_point()+ stat_smooth(method="lm",se=FALSE,aes(group=1,col="All"))+ stat_smooth(method="lm",se=FALSE)+ scale_color_manual("Month",values=myColor) ggplot(airquality,aes(Wind,Temp,col=factor(Month)))+ geom_point()+ stat_smooth(method="lm",se=FALSE)+ scale_color_manual("Month",values=myColor)+ facet_grid(.~Month) #改变主题 ggplot(airquality,aes(Wind,Temp,col=factor(Month)))+ geom_point()+ stat_smooth(method="lm",se=FALSE)+ scale_color_manual("Month",values=myColor)+ facet_grid(.~Month)+ theme_classic()查看全部
-
绘图函数 —qplot() —ggplot()查看全部
-
ggplot2绘图系统 层(Layer) Data Aesthetics Geometeries Facets Statistics Coordinates Themes查看全部
-
#Lattice绘图系统 install.packages("lattice") library(lattice) xyplot(Temp~Ozone,data=airquality) airquality$Month <-factor(airquality$Month) xyplot(Temp~Ozone|Month,data=airquality,layout=c(5,1)) q <- xyplot(Temp~Wind,data=airquality) print(q) set.seed(1)#每次产生的随机数相同 x <- rnorm(100)#随机数服从正态分布 f <- rep(0:1,each=50) y <- x+f-f*x+rnorm(100,sd=0.5) f <- factor(f,labels=c("Group1","Group2")) xyplot(y~x|f,layout=c(2,1)) xyplot(y~x|f,panel=function(x,y){ panel.xyplot(x,y) panel.abline(v=mean(x),h=mean(y),lty=2) panel.lmline(x,y,col="red") })查看全部
-
Lattice绘图系统 绘图函数 —lattice包 xyplot/bwplot/histogram/stripplot/dotplot/splom 格式:xyplot(y~x|f*g,data) panel函数,控制每个面板内的绘图 —grid包 Lattice与Base的重要区别 1、绘图函数查看全部
-
hist(airquality$Wind,xlab = "wind") boxplot(airquality$Wind,xlab = "wind",ylab ="Speed(mph)") boxplot(Wind~Month,airquality,xlab = "Month",ylab ="Speed(mph)") plot(airquality$Wind,airquality$Temp) with(airquality,plot(Wind,Temp,main = "Wind and Temp in NYC")) title(main = "Wind and Temp in NYC") with(airquality,plot(Wind,Temp,main = "Wind and Temp in NYC",type = "n")) with(subset(airquality,Month==9), points(Wind,Temp,col="red")) with(subset(airquality,Month==5), points(Wind,Temp,col="blue")) with(subset(airquality,Month%in%c(6,7,8)), points(Wind,Temp,col="black")) fit <- lm(Temp~Wind,airquality) abline(fit,lwd=2) legend("topright",pch=1, col=c("red","blue","black"), legend=c("Sep","May","Other"))查看全部
-
基本绘图系统 绘图函数(graphics包) —plot/hist/boxplot/point/lines/text/title/axis 基本绘图系统+屏幕设备 * plot(): plot(x,y,...) 重要参数:xlab/ylab/lwd(线的宽度)/lty(线的类型)/pch(点的实心或空心)/col(图形的颜色).... * par() 用于设置全局参数(作用于R中的所有plot绘图) bg(背景颜色)/mar(边距)/las(标签排版)/mfrow(作图按行填充)/mfcol查看全部
-
ggplot2绘图系统(ggplot2 Plotting System) 数据映射到几何客体(颜色/形状/大小)查看全部
-
基本绘图系统(Base Plotting System)查看全部
-
Lattice绘图系统(Lattice Plotting System) —次成图 —观测变量间的交互查看全部
-
小结 数值变量 分类变量查看全部
举报
0/150
提交
取消