[R] Problems combining two plots using par(mfrow=)

Charles Novaes de Santana charles.santana at gmail.com
Sat Apr 18 14:55:42 CEST 2015


Dear all,

I am trying to plot 4 different plots in the same figure using
par(mfrow=...) and igraph::plot.igraph. The code below reproduces more or
less what I am doing:

library(igraph)

g<-erdos.renyi.game(30,0.4)
x<-1:100;

par(mfrow=c(2,2))

hist(degree(g),main="A");
plot(x,sin(x),type="l",xlab="x",ylab="sin(x)",xlim=c(10,60),main="B")
plot(g,main="C");box();
plot(x,sin(x),type="l",xlab="x",ylab="sin(x)",xlim=c(10,60),main="D")

My problem is that the curve plotted in "D" is shown out of the margins. As
it is exactly the same plot as in "B" and in "B" there is no problem with
margins I suppose this is somehow related to the plot of the graph in "C".

I tried to use the function graphics::layout instead of par(mfrow) and the
same problem persists.

I am using R "3.0.2" and Igraph "0.7.1" installed in a machine with Ubuntu
14.04.

I sent this message to Igraph mailing-list but so far nobody could help me.
I wonder if this problem happens also with other combinations of
"par(mfrow)" and other kinds of plots, so I am sending this message also to
this broader mailing list.

Does any of you have any clue about how to solve this?

Thanks for your attention and for any help,

Charles

-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
http://www.imedea.uib-csic.es/~charles

	[[alternative HTML version deleted]]



More information about the R-help mailing list