




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、10. R高階繪圖內(nèi)容概要直方圖柱狀圖餅形圖散點圖箱線圖地圖金字塔圖直方圖hist(x, breaks =Sturges, # breaks語句設(shè)定分組數(shù)量 freq = NULL, # 默認為頻度輸出,freq=FALSE 為按密度輸出density = NULL, #默認沒有填充,density=20(數(shù)字可改),有填充angle = 45, # 接density語句,填充線的傾斜度,默認=45col = NULL, # col設(shè)定顏色,默認黑色border = NULL, # border設(shè)定不同顏色main = paste(Histogram of , xname), # main可以
2、自己設(shè)定題目ylim = NULL, #ylim一般默認,可改變xlab = xname, # xlab設(shè)定自己的labylab, #設(shè)定自己的ylabelaxes = TRUE,# 繪圖默認含坐標軸) hist(x)hist(x, col = red) hist(leaflife, longev, col = red, xlab = Leaf longevity (yr), main = Leaf longevity histgram) hist(leaflife, longev, col = red, xlab = Leaf longevity (yr), main = Leaf long
3、evity histgram, yaxt = n, border = red)axis(2, las = 2)hist(log10(leaflife, longev),col = red, xlab = Leaf longevity (yr),main = Leaf longevity histgram, axes = F, border = red)axis(2, las = 2)axis(1, at = log10(c(0.5, 1, 2, 4), label = c(0.5, 1, 2, 4)柱狀圖library(sciplot)bargraph.CI(x.factor, respons
4、e,group=NULL, col=NULL, density=NULL, angle=NULL, lc=TRUE, uc=TRUE, legend=FALSE, ncol=1, ylim=NULL, xpd=FALSE, data, .) # 加載sciplot包# x軸上的分類變量# 響應變量# 分組變量,默認為空# 顏色,可以按分組指定顏色數(shù)量# 柱子中加入其他線條的密度# 柱子中加入其他線條是的角度# 誤差下限 改成FALSE為不顯示誤差下限# 誤差上限,功能同上# 顯示圖例,默認不顯示圖例# 圖例顯示的列數(shù)# 設(shè)定ylim# 默認文本均在繪圖框里,設(shè)定TRUE可超越# data指定要
5、繪圖的數(shù)據(jù)對象bargraph.CI(x.factor = rain, response = longev, group = soilp, data = leaflife, legend = T, ylab = Leaf longevity, xlab = Precipitation) bargraph.CI(x.factor = rain, response = longev, group = soilp, data = leaflife, legend = TRUE, ylab = Leaf longevity, xlab = Precipitation, ncol = 1, col =
6、black, angle = c(45, 135), density = 20) 堆棧圖barplot(height, width = 1, space = NULL, horiz = FALSE, density = NULL, angle = 45, col = NULL, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, axes = TRUE, .) #矩陣數(shù)據(jù)#柱子寬度設(shè)置#柱子之間距離#圖形垂直輸出# 填充線條密度# 填充線條角度# 顏色# x標示# y標示# x軸刻度范圍# y軸刻度范圍# 默認顯示坐標軸、刻度barplot(
7、dat, ylab = Fraction of explained variance,) barplot(dat, ylab = Fraction of explained variance, border = white, legend = TRUE) barplot(dat, ylab = Fraction of explained variance, border = white, legend = TRUE, xlim = c(0, 8) barplot(dat, xlab = Fraction of explained variance, border = white, horiz
8、= TRUE) f = barplot(dat, xlab = Fraction of explained variance, border = white, horiz = TRUE) 餅形圖pie(x, # x為一維數(shù)組數(shù)據(jù)col = NULL, # 顏色border = NULL, ) # 扇形邊界顏色設(shè)定, 為FALSE效果好pie(large.abund, col = rainbow(length(large.abund) pie2(sort(large.abund), col = rainbow(length(large.abund), border = FALSE, cex =
9、0.8)3D餅圖library(plotrix)# 加載plotrix包pie3D(x,#同餅形圖theta=pi/6,# 視角col=NULL,# 顏色設(shè)定labels=NULL,# 標記說明labelpos=NULL,# 標記位置explode=0,# 扇形裂開性shade=0.8,# 陰影.) pie3D(pieval, explode = 0.2, labels = pielabels) 散點圖library(openair)scatterPlot(mydata, x = nox, y = no2, z = NA, method = scatter, type = default, s
10、mooth = FALSE, linear = FALSE, mod.line = FALSE, cols = hue, log.x = FALSE, log.y = FALSE, .) # 加載openair包#數(shù)據(jù)框# 指示x變量#指示y變量# 默認z缺失# 方法散點圖# 類型默認缺失,可以指定一個分類變量# 局部平滑# 線性回歸# 擬合線# 散點顏色scatterPlot(mydata = leaflife, x = longev, y = lma, type = rain) scatterPlot(mydata = leaflife, x = longev, y = lma, type
11、 = rain, smooth = TRUE) scatterPlot(mydata = leaflife, x = longev, y = lma, type = rain, linear = TRUE) 箱線圖boxplot(x,x是一個公式col = NULL, 設(shè)定顏色log = , 對數(shù)轉(zhuǎn)換horizontal = FALSE, 箱線圖默認為垂直顯示) boxplot(longev site, data = leaflife, xlab = site, ylab = Leaf longevity (yr) 箱線圖(ggplot2模式)library(ggplot2)#加載ggplot
12、2包ggplot (data=NULL,#一個數(shù)據(jù)框格式的數(shù)據(jù)aes(x,# x軸上的分類變量y,# y軸上的分類變量fill)# fill 如果不是x軸上分類變量,雙因素交叉)+geom_boxplot()# 作箱線圖ggplot(leaflife, aes(x = rain, y = longev, fill = rain) + geom_boxplot()ggplot(leaflife, aes(x = rain, y = longev, fill = soilp) + geom_boxplot()地圖-中國地圖地圖-世界地圖3D圖library(fields)drape.plot(x,
13、 y, z,horizontal = TRUE, theta = 30, phi = 20,.) # 加載fields包# x軸上數(shù)值向量, 為一遞增數(shù)列# y軸數(shù)值向量,同上# z是矩陣,行的長度同x軸向量長度,列長度為y軸向量長度# 圖例默認水平顯示(位于圖的下側(cè))# 延x-y軸水平方向視角# 延z軸水平方向視角drape.plot(x, y, volcano, col = terrain.colors(128), theta = 30, phi = 30)3D繪圖動畫金字塔圖Try it!利用sciplot包中的bargraph.CI函數(shù)針對leaflife數(shù)據(jù)做site為分組變量的單因
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 礦產(chǎn)勘查市場分析考核試卷
- 幼兒園防寒防凍安全教育
- 2025尊貴合作伙伴專屬商務咨詢服務合同
- 2025勞動合同書樣本
- 《春曉》小學二年級語文課件
- 2025解除授權(quán)合同范文
- 水廠安全生產(chǎn)培訓大綱
- 幼兒園家長性教育課堂
- 小學生技能培養(yǎng)課程
- 少兒創(chuàng)意美術(shù):重彩棒坦克繪畫課程
- 《關(guān)于強化危險化學品“一件事”全鏈條安全管理的措施》學習解讀
- 【2025新教材】教科版一年級科學下冊全冊教案【含反思】
- 2025年由民政局策劃的離婚協(xié)議官方文本模板
- 高血壓科普健康宣教課件
- 班級安全員信息員培訓
- 科技領(lǐng)域?qū)嶒炇屹|(zhì)量控制關(guān)鍵技術(shù)與方法
- 商場運營部的培訓
- 四年級 人教版 數(shù)學《小數(shù)的意義》課件
- 《糖尿病與肥胖》課件
- 醫(yī)療糾紛防范與醫(yī)患溝通
- 服裝設(shè)計與工藝基礎(chǔ)知識單選題100道及答案
評論
0/150
提交評論