You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to change the segment colors based on edge attributes in my network object in ggnetworkmap()? I see options to do that for the vertices, but there does not appear to be any options for edges. I also tried creating a vector of colors to feed into the segment.color argument, but it returns an error saying "Aesthetics must be either length 1 or the same as the data (702): colour" despite the fact that I only have 69 edges (not 702).
I tried to make an example here:
# load dataset
data(twitter_spambots)
# create colors to set as edge attributescols1<- brewer.pal(n=10, name="Set1")
twitter_spambots %e% "weight"<- sample(cols1, replace=TRUE)
# create a world mapworld<- fortify(maps::map("world", plot=FALSE, fill=TRUE))
world<- ggplot(world, aes(x=long, y=lat)) +
geom_polygon(aes(group=group), color="grey65",
fill="#f9f9f9", size=0.2)
# view global structure
ggnetworkmap(world, twitter_spambots, segment.color=weight) # does not recognize edge attribute name#alternately try creating color vectoredge.cols1<- get.edge.value(twitter_spambots, "weight")
#still doesn't work
ggnetworkmap(world, twitter_spambots, segment.color=edge.cols1)
The text was updated successfully, but these errors were encountered:
Is it possible to change the segment colors based on edge attributes in my network object in ggnetworkmap()? I see options to do that for the vertices, but there does not appear to be any options for edges. I also tried creating a vector of colors to feed into the segment.color argument, but it returns an error saying "Aesthetics must be either length 1 or the same as the data (702): colour" despite the fact that I only have 69 edges (not 702).
I tried to make an example here:
The text was updated successfully, but these errors were encountered: