- plot
- plot(c(1,2,3),c(1,2,4)) # draw 3 points (1,1) (2,2) (3,4)
- plot(c(-3,3),c(-1,5),type="n") # draw a blank canvas, only axis no content
- x<-c(1,2,3)
- y<-c(1,3,8)
- plot(x,y)
- lmout<-lm(y~x) # linear regression
- abline(lmout) # draw line
- lines(c(1.5,2.5),c(3,3)) # draw line with 2 points
- plot(x,y,type="l") # draw broken line
- hist(x)
- x11() # pop a window on linux
- hist(y) # draw y hist on new window
- d1=density(testscores$Exam1,from=0,to=100)
- d2=density(testscores$Exam2,from=0,to=100)
- plot(d1,main="",xlab="")
- lines(d2)
- points(testscores$Exam1,testscores$Exam3,pch="+") # mark point with +
- par(bg="yellow") # yellow background
- text(2.5,4,"abc") # place text on axis(2.5,4)
- hist(c(12,5,13,25,16))
- locator(1) # give the exact axis on hist diagram once
- text(locator(1),"nv=75") # place the text on locator 1's position on diagram
- text(2.5,4,"abc",cex=1.5) # 1.5 times bigger than normal's
- f<-function(x) return(1-exp(-x))
- curve(f,0,2) # draw curve, x starts from 0.2, else from 0 by default
- polygon(c(1.2,1.4,1.4,1.2),c(0,0,f(1.3),f(1.3)),col="gray") # x of 1.2 1.4 1.4 1.2
- plot(testscores)
- lines(lowess(testscores)) # smooth
- curve((x^2+1)^0.5,0.5,add=T) # draw curve on current canvas
- pdf("d12.pdf')
- dev.list() # show devices
- dev.cur()
- pdf 3
- dev.off()
R語言學(xué)習(xí)筆記11-繪圖篇
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- par(mfrow=c(2,3)) #把畫布分為兩行三列,mfrow表示以行優(yōu)先填充 手工決定圖形上點(diǎn)的位置,可...