# [R] Inserting a plot into another

Filoche pmassicotte at hotmail.com
Mon Oct 4 15:58:08 CEST 2010

```Hi everyone.

I have 1 more question regarding subplot.  I'm using this function in a
graph that contains 6 plots (3 x 2). This is producing strange behavior.
http://img545.imageshack.us/img545/9233/fig6.png  See here for the resulting
figure.

For instance here's my code :

pdf(file="C:/Users/Modelisation/Desktop/Fig6.pdf", width = 8.5, height = 11,
pointsize = 12);

par(mfcol = c(3,2), mai = c(0.7,0.8,0,0), omi = c(1, 0, 0.7, 0.1));

plot(FSL.data_Center\$Distance, 4.6/FSL.data_Center\$kd.BLUE., pch = 22, bg =
"gray43", xlab = "Distance (km)", ylab = "1% penetration depth (m) ", ylim =
c(0,20), xaxt = "n", yaxt = "n", xpd = NA);
axis(1, at = c(100,200,300,400,500),labels = c(100,200,300,400,500),
cex.axis=1, tck = 0.02);
axis(2, tck = 0.02);

...

#Subplots
subplot(plot(lowess(FSL.data_North\$Distance, 4.6/FSL.data_North\$kd.BLUE.),
type = 'l', xlab = "", ylab = "", cex.axis = 0.75, xlim = c(0,450), ylim =
c(0,20)), 330,17, size = c(.96, .6));
subplot(plot(lowess(FSL.data_Center\$Distance, 4.6/FSL.data_Center\$kd.RED.),
type = 'l', xlab = "", ylab = "", cex.axis = 0.75, xlim = c(0,450), ylim =
c(0,20)), 330,17, size = c(.96, .6));
subplot(plot(lowess(FSL.data_South\$Distance, 4.6/FSL.data_South\$kd.GREEN.),
type = 'l', xlab = "", ylab = "", cex.axis = 0.75, xlim = c(0,450), ylim =
c(0,20)), 330,17, size = c(.96, .6));

PLOT CODE FOR THE 5 OTHER FIGURES HERE

dev.off();

The last 2 subplots are plotted in at the bottom of the page. I would like
to have the last 2 curves on the plot A.

With regards,
Phil

--
View this message in context: http://r.789695.n4.nabble.com/Inserting-a-plot-into-another-tp2720936p2954362.html
Sent from the R help mailing list archive at Nabble.com.

```