igraph-help
[Top][All Lists]

## [igraph] Cairo and Panel Plots

 From: Lorenzo Isella Subject: [igraph] Cairo and Panel Plots Date: Sat, 14 Nov 2009 22:26:41 +0100 User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707)

```Dear All,
```
I need to generate a poster by stitching together many graph representations.
```Please see the snippet below with some artificial data

rm(list=ls())

library(Cairo)
library(igraph)
library(lattice)

g <- barabasi.game(100, 1/100)
g <- as.undirected(g)
d <- get.diameter(g)

l <- layout.fruchterman.reingold(g)
l <- layout.norm(l, -1,1, -1,1)

```
week <- c("Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
```week_count <- c("1", "2", "3", "4", "5", "6", "7", "8", "9","10","11","12")

CairoPDF("multiple_plots_improved.pdf", width = 50, height = 60)

```
#par(mfrow=c(12,7), cex.main=2, cex.lab=2, srt=45, mar = c(4.5,5, 2, 1) + 0.1)
```
```
#par(mfrow=c(12,7), cex.main=2, cex.lab=2.5, omi=c(0,0,1,0), mar = c(4.5,5, 2, 1) + 0.1)
```
```
par(mfrow=c(12,7), cex.main=2, cex.lab=3., omi=c(0,0,1,0), mar = c(4.5,25, 2, 1) + 0.1)
```

for (i in seq(84)){
j <- i-1
sel_day <- j+1-(j%/%7*7)
k <-  j%/%7+1
plot(g, layout=l,
vertex.label.dist=0.5,   vertex.color="#ff000033",
```
vertex.frame.color="#ff000033", edge.color="#55555533",vertex.label=NA, vertex.size=4, main=week[sel_day],
```#as.expression(c(sprintf("Power = %.3f", power))) ,cex=1.2)
ylab=as.expression(c(sprintf("Week %1d",k)))
)

V(g)\$id <- seq(vcount(g))-1
g2 <- subgraph(g, d)
plot(g2, layout=l[ V(g2)\$id+1, ],
vertex.color="#ff0000", vertex.frame.color="#ff0000",
edge.color="#555555",vertex.label=NA, edge.width=2, vertex.size=4,

```
mtext("Aggregated Networks on One Day at the Science Gallery",3,outer=TRUE,line=1.5,cex=5)
```
}

dev.off()

```
The generated pdf looks good, but I would like to be able to add some extra features like
```(1) A bounding box around each graph plot
```
(2) If I change the dimensions of the pdf (width and height) then the graph subplots do not seem to scale trivially i.e. if I change width = 50, height = 60 to width = 100, height = 120 then the panel subplots do not simply double their width and height i.e. I am not simply magnifying the plot. Hence my question: if I find an overall layout that I like, will it print out nicely as e.g an A0? Will I lose image definition if I blow up the panel plot to print it poster size?
```Many thanks

Lorenzo

```