[R] using a variable and a superscript in a legend

Patrick Giraudoux p@tr|ck@g|r@udoux @end|ng |rom un|v-|comte@|r
Sun Oct 20 15:05:08 CEST 2019


Thanks Eric. I got it too already (and already tried some variations 
based on it), but to my understanding it does not include a variable 
whose contents is used in the expression as in the case submitted...


Le 20/10/2019 à 14:56, Eric Berger a écrit :
> I did a Google search on
>
> R plot superscript in legend
>
> and the first search result was
> https://stackoverflow.com/questions/20453408/superscript-r-squared-for-legend 
>
>  which looks like it might address your question.
>
> On Sun, Oct 20, 2019 at 3:30 PM Patrick Giraudoux 
> <patrick.giraudoux using univ-fcomte.fr 
> <mailto:patrick.giraudoux using univ-fcomte.fr>> wrote:
>
>     Dear listers,
>
>     I am trying to pass an expression inlcuding a variable and a
>     superpscript to a legend. What I want to obtain is e.g. with
>     densren = 1.25
>
>     1.25 ind./km^2
>
>     I have tried many variants of the following:
>
>     legend=bquote(.(densren) (ind./km)^2)
>
>     but if not errors, do obtain
>
>     1.25 (ind./km^2)
>
>     hence not what I want (no parenthesis, 2 in superscript...)
>
>     Any idea about a correct syntax to get what I need ?
>
>     Best,
>
>     Patrick
>
>
>             [[alternative HTML version deleted]]
>
>     ______________________________________________
>     R-help using r-project.org <mailto:R-help using r-project.org> mailing list --
>     To UNSUBSCRIBE and more, see
>     https://stat.ethz.ch/mailman/listinfo/r-help
>     PLEASE do read the posting guide
>     http://www.R-project.org/posting-guide.html
>     and provide commented, minimal, self-contained, reproducible code.
>


	[[alternative HTML version deleted]]



More information about the R-help mailing list