[R] Add points to subplots

Luca Cerone luca.cerone at gmail.com
Fri Jun 13 12:02:34 CEST 2014

Thanks David,
I already did this, but in case the code gets updated I will have to
re-add the annotation, which I do not think it is ideal.

I was just wondering if there is an easy solution to this.
Thanks a lot for the help,


2014-06-13 3:12 GMT+02:00 David Winsemius <dwinsemius at comcast.net>:
> On Jun 12, 2014, at 8:06 AM, Luca Cerone wrote:
>> Dear all,
>> I am running some analysis using the pamr package (available on CRAN).
>> One of the plots I produce is made using the function "pamr.plotcv".
>> This displays two plots in the same figure (using par(mfrow=c(2,1)).
>> When the figure is created, I would like to be able to add some points
>> and lines, to the top plot.
>> After producing the plot with pamr.cvplot, I have tried to add a line
>> doing something like:
>> par(mfg=c(1,1))
>> lines(c(3,3), c(0,1), col = "blue", lty = 3)
>> However this doesn't work and the line is shown in the bottom plot.
>> How can I add points and lines to the top plot?
> I think you would be better off hacking the code and inserting your desired annotations before the focus is moved to the second region. There are split screen methods that allow changing focus for base graphics, but I'm not aware of ones that use the par() controls.
> --
> David Winsemius
> Alameda, CA, USA

Luca Cerone

Tel: +34 692 06 71 28
Skype: luca.cerone

More information about the R-help mailing list