igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Overlaying two plots with different vertex sizes


From: Tamas Nepusz
Subject: Re: [igraph] Overlaying two plots with different vertex sizes
Date: Thu, 26 Aug 2010 16:30:09 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

Hi David,

> I get the following error, which I assume is happening because there
> are less nodes in g than there are in g2.
Yes; basically, the layout of the graph (that you pass as the value of
the layout= argument) must have exactly the same number of rows as the
number of vertices in the graph. The same applies to the vertex.color=
keyword argument; igraph does not complain about it because it bailed
out earlier at the layout calculation :)

Anyway, I'd do the following:

1. Add the node colors as vertex attributes to g and g2, so you don't
have to pass vertex.color=.... You should use the "color" vertex
attribute to make it work. This has the advantage that if you derive g2
from g by calling subgraph(), vertex attributes will be kept, so there's
no need to calculate the vertex colors for g2 again.

2. For the layout, you should calculate it first for the larger network,
then select the rows which are required in the smaller network and pass
only those rows when you plot the smaller graph.

Alternatively, you can make both graphs have the same number of
vertices; remove the edges that you don't need from the smaller graph,
set the shape of the vertices that you don't need to "none", and also
set their labels to an empty string. This will hide these vertices
completely on the plot.

-- 
Tamas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]