I have read the posts on how to create italicized words in a graph title, but it does not seem to be working for me.
#create a list of species
sp <- c(\"E
There argument you are passing to main needs a couple of changes.
To use R's plotmath specials (i.e. things like italic()), it should be an expression object rather than a character string. That means doing something like this:
main = expression(paste("Length-Freq of", italic("E. coruscans"), "by Gear"))
instead of this:
main = paste("Length-Freq of", italic("E. coruscans"), "by Gear")
In addition, you are wanting to italicize i's value rather than its name, but if you just type italic(i), lattice will render i's name as a little italic "i" for each species. Use bquote() or substitute() to substitute in i's value instead, as demonstrated here:
i <- "E. coruscans"
xyplot(1:10~1:10,
main = substitute(expr = expression(paste("Species name: ", italic(i))),
env = list(i=i)))
