简体   繁体   English

如何告诉mosaic(mosaic plot,R,VCD包)即使在使用residual shading时也总是打印p值?

[英]How to tell mosaic (mosaic plot, R, VCD package) to always print the p value even when using residual shading?

When I make a mosaic plot with default shading shade=T the p-value displays under the legend当我使用默认阴影shade=T制作马赛克 plot 时,p 值显示在图例下方

mosaic(~ gear + carb, data = mtcars, shade=T)

在此处输入图像描述

When I instead use Friendly2 shading, I don't get the p-value.当我改为使用Friendly2着色时,我没有得到 p 值。

mosaic(~ gear + carb, data = mtcars, gp=shading_Friendly2)

在此处输入图像描述

I think the best approach to this would be to use a different shader that contains the p-value by default (like shading_hcl) and then modify the color of that shader ( https://rdrr.io/cran/vcd/src/R/shadings.R )我认为最好的方法是使用默认包含 p 值的不同着色器(如 shading_hcl),然后修改该着色器的颜色( https://rdrr.io/cran/vcd/src/R /阴影.R

So to make your example working with that new shader:因此,要让您的示例使用该新着色器:

cars <- table(mtcars$gear, mtcars$carb)

mosaic(cars, gp = shading_hcl(observed=cars, eps=0.01, lty=1:2, h=c(260,0), c=c(200, 200), l=c(90, 50)))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM