[英]Size of plots Knitr
我正在嘗試更改wordcloud
的大小,但我不知道該怎么做。 顯然較低的fig.width
值會使 plot 更大,而不是更小,反之亦然。 它似乎占據了巨大的空間,與第二個 plot 相比,它的尺寸剛剛好。
\documentclass{report}
\begin{document}
<<echo=FALSE,message=FALSE,warning=FALSE,fig.width=3>>=
library(wordcloud)
set.seed(1)
freq<-sample(letters,2000,prob=1:26,rep=T)
wordcloud(names(table(freq)),table(freq),min.freq=60,colors=brewer.pal(6,"Dark2"),scale=c(1,.2))
@
<<echo=FALSE,warning=FALSE>>=
library(ggplot2)
freq<-table(freq)
wf<-as.data.frame(freq)
wf$freq<-ordered(wf$freq,levels=wf$freq[order(wf$Freq)])
ggplot(subset(wf,Freq>60),aes(freq,Freq)) +
geom_bar(stat="identity") +
theme(axis.text.x=element_text(angle=45,hjust=1))
@
\end{document}
arguments fig.width
和fig.height
提供兩個軸之間的縱橫比:為了在您的編織/導出文檔中指示 plot 的大小,您應該同時使用它們(例如,在編織時使用 pandoc一個 rmarkdown 文件到 a.docx)。
或者, fig.asp =
讓您調整圖像的大小(例如,用fig.asp = 2
)。 但是,此方法在導出期間(在后台)仍然提供fig.height
和fig.width
參數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.