Garbled plot label
On Mon, 25 Apr 2005, Henric Nilsson wrote:
Uwe Ligges said the following on 2005-04-25 10:22:
Maciej Blizi??ski wrote:
Hello, While using the "plot" function against a model with a long formula, I get a garbled label in the bottom of the plot. It looks like there are two lines printed one over another, here's my example: http://pico.magnum2.pl/maciej/NodalInvolvement/MisclassificationRate?action=AttachFile&do=get&target=TwoFactorResiduals.png This was from using "plot(model_object)" which produces 4 plots at once. Can I fix it somehow? I already tried googling, and searching R maillist archives and didn't find a relevant discussion.
Can you provide a reproducible example please (the posting guide ask to do so anyway)?
It's quite easy to reproduce this. Just long.var.name.1 <- runif(10) long.var.name.2 <- runif(10) long.var.name.3 <- runif(10) long.var.name.4 <- runif(10) fit <- lm(long.var.name.1 ~ long.var.name.2 + long.var.name.3 + long.var.name.4) plot(fit)
To remove the problem in the plot, do: plot(fit, sub.caption="") As it is, sub.caption = deparse(x$call) by default, and
deparse(fit$call)
[1] "lm(formula = long.var.name.1 ~ long.var.name.2 + long.var.name.3 + "
[2] " long.var.name.4)"
so this is two lines on top of each other. Unrolling:
plot(fit, sub.caption=gsub("[ ]+", " ", paste(deparse(fit$call), collapse="")))
still works, but is becoming very long. Would a better default perhaps be
the name of the first argument?
Roger
//H
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no