On Wed, 15 May 2013, Vanessa Vetter wrote:
Hello everyone,
is there a way to increase the distance between the legend label of the
Pearson residuals and the bar, which shows the color of the residuals, in
the mosaic plot argument (see picture attached)? The minus signs of the
negative scale unfortunately run into the bar. They are therefore difficult
to read.
I don't think that there is a way to do this directly. A workaround that
can be used to avoid the problem is to specify a "range" and the number of
"ticks" that just leads to fewer digits. For example, for your data you
could set legend_args = list(range = c(-1.9, 1.9), ticks = 5).
For a reproducible example, consider
ipol <- function (x) pmin (x / 4, 1)
mosaic(~ Hair + Eye, data = HairEyeColor,
shade = TRUE, gp_args = list(interpolate = ipol),
legend_args = list(range = c(-7.1, 7.1), ticks = 7))
I have cc'ed David Meyer, the maintainer of vcd. David, for fixing the
problem, I think we should compute 'tw' in legend_resbased() only based on
digits but better on the actual rounded 'at' values. For example, we could
do the following (maybe with digits = 2 rather than 3):
if(is.null(at)) {
at <- seq(from = head(col.bins, 1), to = tail(col.bins, 1), length = ticks)
lab <- format(round(at, digits = digits), nsmall = digits)
}
tw <- lab[which.max(nchar(lab))]
I would also like to change both, the color of the residuals as well as the
"data driven cut-off points for residuals". But so far I could not combine
the two commands. Is this possible?
# Colorized with HCL default colors and data driven cut-off points for
residuals:
ipol <- function (x) pmin (x / 4, 1)
mosaic (~ herbivory treatment + + + altitude competition, data = erillm1,
shade = TRUE, legend = TRUE, gp_args = list (interpolate = ipol),
labeling_args = list (abbreviate_labs = c (herbivory = TRUE)))
# Colorized with HCL but color matched and default cut-off points for
residuals:
I'm not sure what exactly you want to change here, the ipol function above
appears to work as intended.
Hope that helps,
Z
I have now been several papaer to vcd package and strucplot read, but could
find no information on this.
Thank you very much for your help!
greeting
Vanessa Vetter
(Diploma Environmental Sciences, University of Koblenz-Landau)
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.