2017-07-03 57 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