[R] Mixing plotting symbols with text

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Tue Jun 7 22:12:56 CEST 2022


I assume this is using R's basic plotting engine.

If so, you **might** be able to do this nicely with legend(). Jim Lemon's
plotrix package might also have something for you.

Otherwise you can set plot limits explicitly, and then plot the point
outside those limits with your desired pch by setting xpd = TRUE. Something
like:

plot(c(1,1.5,2), c(3,5.5,4), pch = c(1,3,1), ylim = c(2.5,4.5),
     xpd = TRUE)

Then use mtext() to add your text nearby.
Inelegant, but it should work.

Cheers,
Bert Gunter


On Tue, Jun 7, 2022 at 12:39 PM Erin Hodgess <erinm.hodgess using gmail.com>
wrote:

> Hello!
>
> Hope you’re having a great day!
>
> I would like to combine plotting symbols with text.
>
> I have tried
> xp2a <- expression(paste(pch =3, “my stuff”))
> But when I use that as a plot title, it just shows as “3 my stuff”.
>
> I have a feeling that it’s going to be something very straightforward that
> I am missing.
>
> Thanks for your help,
> Sincerely,
> Erin
> --
> Erin Hodgess, PhD
> mailto: erinm.hodgess using gmail.com
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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