I am creating a social network graph that is based on a Twitter dataset. I calculated sentiment analysis scores for the tweets and I wanted to color-code the nodes according to the sentiment score. There are 7 different categorical values that I want to use I want to have a different color to represent each sentiment score. The sentiment values are "neutral," "somewhat positive," "positive," "very positive," "somewhat negative," "negative," and "very negative." I am using igraph in R to accomplish this and I got a simpler version with just two sentiment states working, i.e. "positive" and "negative."Here was the code that I used for that graph:
V(rt_graph)$color <- ifelse(tweets[V(rt_graph), 2] == "positive", "blue", "red")
I was attempting to assign a different color to each node of a different sentiment value, but I have not been successful in figuring out how to do that. Could someone please put me in the right direction? Here is what I was trying to work with:
V(rt_graph)$color(tweets$score[V(rt_graph) == 'Negative']) <- 'orangered3'
