Hello,
I want to add superscripts to my legend title but nothing I do seems to work. I want the legend title to say "Density (indiv m-3)" with the m-3 as the superscript. This is the line of code that I have to combine the size and color aesthetics into one legend (using guides()
) and then labeling the legend "Density (indiv m-3)".
guides(color='legend', size='legend') + #combine size and color aesthetics into one legend
labs(color = bquote('Density'~(indiv m^(-3))), size = bquote('Density'~(indiv m^(-3))))
# label legend with superscripts
But I keep getting error messages such as:
Error: unexpected symbol in:
" guides(color='legend', size='legend') +
labs(color = bquote('Density'~(indiv m"
> }
Error: unexpected '}' in "}"
I'm sure it's a really simple fix that I'm just not seeing. Can somebody help?
Thanks so much!