|
From: | Vincent Matossian |
Subject: | Re: [igraph] postscript and label.family and a question about layout.lgl |
Date: | Sat, 7 Jul 2007 19:36:51 -0400 |
On Fri, Jul 06, 2007 at 06:54:55PM -0400, Vincent Matossian wrote:
>
> I had completely missed that, thanks for the quick fix Gabor! :)
>
> I'm trying to create a legend with something similar to colorkey in
> heat/level/
> contour plots, but with the colors representing colors as
> properties of nodes
> in the graph. Does anyone have an idea how it can be done in R?
Hmm, i'm not sure what exactly you mean, but here are two guesses:
##############
# http://www.rmki.kfki.hu/~csardi/colorbar2.png
library(igraph)
g <- barabasi.game(100)
V(g)$color <- sample(heat.colors (5), vcount(g), repl=TRUE)
lay <- layout.fruchterman.reingold(g)
plot(g, layout=lay, vertex.size=5, vertex.label=NA,
edge.arrow.size=0.6, margin=-0.2)
legend(-1.2, -1.1, col=heat.colors(5), c("foo", "bar", "foobar", "what", "is"),
fill=heat.colors(5), yjust=0)
################
# http://www.rmki.kfki.hu/~csardi/colorbar2.png
g <- barabasi.game(100)
V(g)$color <- sample( heat.colors(20), vcount(g), repl=TRUE)
lay <- layout.fruchterman.reingold(g)
plot(g, layout=lay, vertex.size=5, vertex.label=NA,
edge.arrow.size=0.6, margin=c(-0.1,0.1,-0.1,-0.1))
library(fields)
colorbar.plot(-1.1, 1, strip=1:20, strip.width=0.05,
strip.length=1, col=heat.colors(20),
horizontal=FALSE, adj.x=1, adj.y=1)
rect(-1.1,1,-1.1-(2.3*0.05),-1)
################
I don't really like colorbar.plot though, there might be a better
solution, you may ask it on the R-help list.
Gabor
> thanks
> -
> Vincent
>
--
Csardi Gabor < address@hidden> MTA RMKI, ELTE TTK
_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help
[Prev in Thread] | Current Thread | [Next in Thread] |