[R] Problems combining two plots using par(mfrow=)
Charles Novaes de Santana
charles.santana at gmail.com
Sat Apr 18 17:28:00 CEST 2015
Thank you for your message! I had experienced exactly what you describe in
your message. I just didn't write in my previous message in order to avoid
a long message :) I will definitely file a bug report to Igraph. Thanks for
In the meanwhile, I will try the first workaround you suggested. It worked
fine for what I am doing.
Thanks for your time! Have a nice weekend!
On Sat, Apr 18, 2015 at 4:20 PM, Boris Steipe <boris.steipe em utoronto.ca>
> I can reproduce your problem. It affects both sine-waves if the graph is
> plotted as the second plot, so it seems that plotting the graph affects all
> subsequent plots. It affects all plots in subsequent plots to the same
> window. The window needs to be closed to correct this. I would file a bug
> Two quick workarounds: plot only the x-values contained in your xlim
> range, or plot the graph last.
> On Apr 18, 2015, at 8:55 AM, Charles Novaes de Santana <
> charles.santana em gmail.com> wrote:
> > 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.
> > 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
> > I tried to use the function graphics::layout instead of par(mfrow) and
> > same problem persists.
> > I am using R "3.0.2" and Igraph "0.7.1" installed in a machine with
> > 14.04.
> > I sent this message to Igraph mailing-list but so far nobody could help
> > 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
> > 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]]
> > ______________________________________________
> > R-help em r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > and provide commented, minimal, self-contained, reproducible code.
Um axé! :)
Charles Novaes de Santana, PhD
[[alternative HTML version deleted]]
More information about the R-help