[R] Problems combining two plots using par(mfrow=)
Charles Novaes de Santana
charles.santana at gmail.com
Sat Apr 18 18:49:00 CEST 2015
Just open this issue: https://github.com/igraph/rigraph/issues/69
Thanks again for your suggestion!
Best,
Charles
On Sat, Apr 18, 2015 at 5:28 PM, Charles Novaes de Santana <
charles.santana em gmail.com> wrote:
> Dear Boris,
>
> 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
> your suggestion.
>
> In the meanwhile, I will try the first workaround you suggested. It worked
> fine for 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[40:90],sin(x[40:90]),type="l",xlab="x",ylab="sin(x)",xlim=c(40,90),main="D")
> plot(g,main="C");box();
>
> plot(x[40:90],sin(x[40:90]),type="l",xlab="x",ylab="sin(x)",xlim=c(40,90),main="D")
>
> Thanks for your time! Have a nice weekend!
>
> Charles
>
>
>
> On Sat, Apr 18, 2015 at 4:20 PM, Boris Steipe <boris.steipe em utoronto.ca>
> wrote:
>
>> 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
>> report.
>>
>> Two quick workarounds: plot only the x-values contained in your xlim
>> range, or plot the graph last.
>>
>> Cheers,
>> B.
>>
>>
>>
>> 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. 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]]
>> >
>> > ______________________________________________
>> > 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
>> http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
>
> --
> Um axé! :)
>
> --
> Charles Novaes de Santana, PhD
> http://www.imedea.uib-csic.es/~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