Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems when plotting graph in a multi-plot window #69

Closed
cndesantana opened this issue Apr 18, 2015 · 2 comments
Closed

Problems when plotting graph in a multi-plot window #69

cndesantana opened this issue Apr 18, 2015 · 2 comments
Milestone

Comments

@cndesantana
Copy link

Dear all,

I am trying to depict 4 plots in the same figure using par(mfrow=c(2,2)) to organize the plots. As the example below:

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".

Also, if the graph is plotted as the second plot It affects both sine-waves, 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.

The same problem happens when I use the function graphics::layout instead of par(mfrow) and the same problem persists.

I wonder if it is a bug of plot.igraph. I am using R "3.0.2" and Igraph "0.7.1" installed in a machine with Ubuntu 14.04.

Thanks for any help

@gaborcsardi
Copy link
Contributor

Yes, this is a bug. A workaround is to save and re-set the xpd parameter after the igraph plot: par(xpd = FALSE)

@ntamas
Copy link
Member

ntamas commented Oct 29, 2022

Fixed in 133f74d

@ntamas ntamas closed this as completed Oct 29, 2022
@ntamas ntamas added this to the 1.3.6 milestone Oct 29, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants