[R] ggraph and changing colors in geom_node_arc_bar

Monica Palaseanu-Lovejoy mon|c@p@|@|ovejoy @end|ng |rom gm@||@com
Wed Apr 22 14:31:04 CEST 2020


 Hi,

I am playing with the ggraph that is amazing. But i don't quite understand
some of the options it has. For example:

gr <- graph_from_data_frame(flare$edges, vertices = flare$vertices)

l <- ggraph(gr, layout = 'partition', circular = TRUE)
l + geom_node_arc_bar(aes(fill = depth)) +
    coord_fixed()

This will give a nice graph in shades of blue.
But if i want to change the fill aesthetic with a grey scale for example:

l + geom_node_arc_bar(aes(fill = grey(seq(0,1,length=252)))) +
    coord_fixed() +
theme(legend.position = "none")

This will give a graphic with set colors that definitely are not on a grey
scale. So i am missing a piece in my code.
I tried to add scale_edge_fill_manual(values= grey(seq(0,1,length=252)))
but to no avail, and besides this has to do with edges and not nodes. So
this is not the solution.

What i am doing wrong, or what i am missing from my command?

Also i am interested how the graph and ggraph plots, in the sense in what
order is the data plotted? I am interested in that because i may want to
set up either colors or widths of edges separately from my graph data for
visualization.

Thanks,
Monica

	[[alternative HTML version deleted]]



More information about the R-help mailing list