Dear R-Users,
1. I was finally able to get the colours to work properly. The solution is
based on Vaclav's and Deepayan's suggestions. I have included the code for
anyone interested.
library(lattice)
library(nlme)
panel.col = function (x, y, subscripts, groups, ...)
{
panel.grid()
panel.xyplot(x, y, ..., groups = groups, subscripts = subscripts)
panel.superpose(x, y, subscripts, groups, type = "l")
}
tmp = plot(BodyWeight, innerGroups = ~ Diet)
tmp$panel = panel.col
tmp
2. Modify Text Size
I also wanted to generate some images for a presentation. I wanted to increase
the text size so that relevant text becomes easy to read. After many failed
attempts, I found it easier to modify the resulting trellis-object.
The code is rather hacky. For anyone interested, see function setCEX on GitHub:
https://github.com/discoleo/R/blob/master/Stat/Models.MixedEffects.R
I may try to improve it - when I have a little bit more spare time.
Sincerely,
Leonard
________________________________
From: R-help <[email protected]> on behalf of
[email protected] <[email protected]>
Sent: Tuesday, December 2, 2025 1:00 PM
To: [email protected] <[email protected]>
Subject: R-help Digest, Vol 274, Issue 1
Send R-help mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://stat.ethz.ch/mailman/listinfo/r-help
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-help digest..."
Today's Topics:
1. lme: Plot colours based on variable? (Leo Mada)
----------------------------------------------------------------------
Message: 1
Date: Tue, 2 Dec 2025 08:39:09 +0000
From: Leo Mada <[email protected]>
To: Leo Mada via R-help <[email protected]>
Subject: [R] lme: Plot colours based on variable?
Message-ID:
<dbap192mb0956e139bff599808e8bea7784...@dbap192mb0956.eurp192.prod.outlook.com>
Content-Type: text/plain; charset="utf-8"
Dear R-Users,
Is there a quick solution to plot colours based on a variable?
I tried something like this:
library(nlme)
plot(BodyWeight)
# Does NOT work!
colDiet = c(2:4)[BodyWeight$Diet]
plot(BodyWeight, col = colDiet)
# Wastes space
rat.fit = lme(weight ~ Time + Diet, data = BodyWeight, random = ~ Time|Rat)
plot(rat.fit, weight ~ Time | Rat + Diet)
Is there a quick way to base the colour on the Diet variable?
Many thanks,
Leonard
[[alternative HTML version deleted]]
------------------------------
Subject: Digest Footer
_______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
------------------------------
End of R-help Digest, Vol 274, Issue 1
**************************************
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.