2017-07-03 131 views
0

有了這個代碼:顯示百分比規模ggMarginal情節

ggMarginal(p1, margins = "x", size = 2, type = "histogram", 
     col = "blue", fill = "orange") 

我可以做這種類型的圖:

ggMarginal

但我想顯示直方圖的y軸以百分比爲單位的值,你能幫助我嗎?

+0

請仔細閱讀[如何使R中一個偉大的可重複的例子?(https://stackoverflow.com/questions/5963269/how-對做 - 一個偉大-R重現-例子)。處理一些數據比投擲一些猜測來回答你的問題容易得多。 – Masoud

+0

https://github.com/ChrKoenig/R_marginal_plot – Masoud

回答

0

你應該導入包(scales),應該是這個樣子

... 
library('scales') 
ggMarginal(p1, margins = "x", size = 2, type = "histogram", 
     col = "blue", fill = "orange") + scale_y_continuous(labels=percent) 
+0

謝謝,但它給了我這個錯誤:ggMarginal中的錯誤(p1,margin =「x」,size = 2,type =「histogram」,col =「blue」, : 二元運算符的非數字參數 – user40267