導(dǎo)出到office(ppt和word)中的圖形,是可編輯的:
其它導(dǎo)出到ppt的例子(設(shè)置長(zhǎng)寬比)
graph2ppt(file="ggplot2_plot.pptx", aspectr=1.7)
增加第二張同樣的圖,9英寸寬和A4長(zhǎng)寬比的幻燈片 (append=T,追加)
graph2ppt(file="ggplot2_plot.pptx", width=9, aspectr=sqrt(2), append=TRUE)
添加相同圖形的第三張幻燈片,寬度和高度固定
graph2ppt(file="ggplot2_plot.pptx", width=6, height=5, append=TRUE)
禁用矢量化圖像導(dǎo)出
graph2ppt(x=x, file=filen, vector.graphic=FALSE, width=9, aspectr=sqrt(2), append = TRUE)
用圖填滿幻燈片
graph2ppt(x=x, file=filen, margins=0, upscale=TRUE, append=TRUE)
輸出矢量圖
- graph2svg: 將當(dāng)前的R圖保存為SVG格式
- graph2pdf: 將當(dāng)前的R圖保存為PDF格式
- graph2eps: 將當(dāng)前的R圖保存為EPS格式
graph2vector(x = NULL, file = "Rplot", fun = NULL, type = "SVG",aspectr = NULL,width = NULL, height = NULL, scaling = 100,font = ifelse(Sys.info()["sysname"] == "Windows","Arial","Helvetica")[[1]], bg = "white", colormodel = "rgb",cairo = TRUE,fallback_resolution = 600, ...)- fallback_resolution: dpi中的分辨率用于柵格化不支持的矢量圖形 。
#需運(yùn)行上面的ggplot2繪圖# Create a file namefilen <- "output_filename" # or# filen <- paste("YOUR_DIR/ggplot")# There are 3 ways to use graph2vector():### 1. Pass the plot as an object# 導(dǎo)出圖形對(duì)象graph2svg(x=x, file=filen, aspectr=2, font = "Times New Roman",height = 5, bg = "white")graph2pdf(x=x, file=filen, aspectr=2, font = "Arial",height = 5, bg = "transparent")graph2eps(x=x, file=filen, aspectr=2, font = "Arial",height = 5, bg = "transparent")# 導(dǎo)出當(dāng)前預(yù)覽窗口呈現(xiàn)的圖### 2. Get the plot from current screen devicexgraph2svg(file=filen, aspectr=2, font = "Arial",height = 5, bg = "transparent")graph2pdf(file=filen, aspectr=2, font = "Times New Roman",height = 5, bg = "white")graph2eps(file=filen, aspectr=2, font = "Times New Roman",height = 5, bg = "white")# 導(dǎo)出自定義函數(shù)輸出的一系列圖### 3. Pass the plot as a functiongraph2svg(file=filen, fun = plot.fun, aspectr=2, font = "Arial",height = 5, bg = "transparent")graph2pdf(file=filen, fun=plot.fun, aspectr=2, font = "Arial",height = 5, bg = "transparent")graph2eps(file=filen, fun=plot.fun, aspectr=2, font = "Arial",height = 5, bg = "transparent")轉(zhuǎn)換3D圖形rgl2png: 將當(dāng)前的rgl 3D圖形保存為PNG格式 。
rgl2bitmap(file = "Rplot", type = c("PNG"))# Create a file namefilen <- tempfile("rgl") # or# filen <- paste("YOUR_DIR/rgl")# Generate a 3D plot using 'rgl'x = y = seq(-10, 10, length = 20)z = outer(x, y, function(x, y) x^2 + y^2)rgl::persp3d(x, y, z, col = 'lightblue')# Save the plot as a pngrgl2png(file = filen)# Note that omitting 'file' will save in current directory生成的3D圖形:
將生成的3D圖形保存為PNG格式:
輸出統(tǒng)計(jì)結(jié)果到表格 table2spreadsheet
- table2excel: 導(dǎo)出統(tǒng)計(jì)輸出到Microsoft Office Excel/ LibreOffice Calc電子表格中的一個(gè)表.
- table2csv:將統(tǒng)計(jì)輸出以CSV格式導(dǎo)出到表中(“,”表示值分隔,“ 。”表示小數(shù))
- table2csv2: 將統(tǒng)計(jì)輸出以CSV格式導(dǎo)出到表中(“;”表示值分隔,”,”表示小數(shù))
table2spreadsheet(x = NULL, file = "Rtable", type = c("XLS", "CSV","CSV2"), append = FALSE, sheetName = "new sheet", digits = 2,digitspvals = 2, trim.pval = TRUE, add.rownames = FALSE, ...)- sheetName: 一個(gè)字符串,給出創(chuàng)建的新工作表的名稱(chēng)(僅針對(duì)type==”XLS”) 。它必須是惟一的(不區(qū)分大小寫(xiě)),不受文件中任何現(xiàn)有工作表名稱(chēng)的影響 。
- digits:除具有p值的列外,要顯示所有列的有效位數(shù)的數(shù)目 。
- digitspvals:具有p值的列要顯示的有效位數(shù)的數(shù)目 。
以上關(guān)于本文的內(nèi)容,僅作參考!溫馨提示:如遇健康、疾病相關(guān)的問(wèn)題,請(qǐng)您及時(shí)就醫(yī)或請(qǐng)專(zhuān)業(yè)人士給予相關(guān)指導(dǎo)!
「愛(ài)刨根生活網(wǎng)」www.malaban59.cn小編還為您精選了以下內(nèi)容,希望對(duì)您有所幫助:- PDF轉(zhuǎn)換成Excel的方法 PDF如何轉(zhuǎn)換成EXCEL
- 南方立秋吃什么 立秋養(yǎng)生吃什么好
- 如何防蚊蟲(chóng)叮咬 夏天防蚊蟲(chóng)的方法
- 秋冬季如何養(yǎng)生 秋冬季健康養(yǎng)生方法
- 夏季如何養(yǎng)生 夏季養(yǎng)生飲食小常識(shí)
- 冬季御寒措施 冬季如何保暖御寒
- 天冷吃什么食物好 什么茶適合天冷喝
- 圖文 屬鼠都是怎么看待抑郁癥患者的
- 圖文 關(guān)燈后 屬鼠女生最喜歡跟男友聊什么
- 圖文 最讓屬鼠在生活中感覺(jué)到驕傲的時(shí)候
