[R] Question about italics in legendg() - plotrix

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Wed Feb 15 03:11:39 CET 2023


Hi Nicole,
plotrix is intended to be modular, that is, it builds plots step by step.
This makes it easier to understand code that you haven't written or haven't
seen for a while. Here is an example showing how to change the font using
par():

library(plotrix)
plot(0,type="n",xlim=c(0,1),ylim=c(-1,0))
par(font=3)
legendg(0.115,-0.055,legend=c("Pan troglodytes","Macaca mulatta",
 "Saguinus oedipus","Lemur catta","Galago senegalensis"),
pch=list(c(15,0),c(16,1),c(17,2),c(18,5),c(19,10)),
 col=list(c("royalblue","skyblue1"),
 c("chocolate","gold"),c("deeppink","lightpink"),
 c("black","grey"),c("forestgreen","lightgreen")))
par(font=1)
legendg(0.45,-0.7,legend=c("Pan troglodytes","Macaca mulatta",
 "Saguinus oedipus","Lemur catta","Galago senegalensis"),
pch=list(c(15,0),c(16,1),c(17,2),c(18,5),c(19,10)),
 col=list(c("royalblue","skyblue1"),
 c("chocolate","gold"),c("deeppink","lightpink"),
 c("black","grey"),c("forestgreen","lightgreen")))

There are 4 or 5 preset font types built into R (normal, bold, italic,
bolditalic and maybe symbol). You can also change the base font using the
family= argument to par(), but that's quite a bit more complicated.

Jim

	[[alternative HTML version deleted]]



More information about the R-help mailing list