简体   繁体   中英

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

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

在此处输入图像描述

When I instead use Friendly2 shading, I don't get the p-value.

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 )

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)))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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