I have a vector with different species names. For example:
sp_names<-c("sp1","sp2","sp3")
I have to make a map for each species and I need each species name written in italic in the title of the legend. Searching on the stackoverflow I found a suggestion to use susbtitute
. I have tried like this:
legend(title=substitute(italic(sp_names), list(sp_names=sp_names[1])),
"left",
pch=21,col="black",pt.bg="darkgreen",
legend = "Registro de ocorrĂȘncia",
cex = 0.7,
bty = "n")
But I've got this error:
Error in legend(title = substitute(italic(title_leg), list(title_leg = title_leg[1])), :
invalid 'title'
Could you help me? Thank you