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
Possibly this is known behaviour but just thought I would report it in case it wasn't. When you try to
colour edges using a numeric variable without loading ggraph the values are interpreted as literal colours rather than continuous numeric values.
Toy example graph:
library(tidygraph)
#> Warning: package 'tidygraph' was built under R version 4.0.2#> #> Attaching package: 'tidygraph'#> The following object is masked from 'package:stats':#> #> filternodes<-data.frame(
node= c(1, 2, 3, 4)
)
edges<-data.frame(
from= c(1, 2, 2),
to= c(2, 3, 4),
weight= c(5, 3, 2)
)
graph<- tbl_graph(nodes=nodes, edges=edges)
If we plot this without loading ggraph we get three distinct colours for the edges:
I think they are being interpreted as literal colours rather than a factor because if you change the weights the colours change and if you give a negative weight you get his error:
ggraph::ggraph(graph, layout="fr") +ggraph::geom_edge_link(ggplot2::aes(colour=-weight)) +ggraph::geom_node_point()
#> Error: colours encodes as numbers must be positive
If we load ggraph we get a continuous colour scale as expected:
Hi
Possibly this is known behaviour but just thought I would report it in case it wasn't. When you try to
colour edges using a numeric variable without loading ggraph the values are interpreted as literal colours rather than continuous numeric values.
Toy example graph:
If we plot this without loading ggraph we get three distinct colours for the edges:
I think they are being interpreted as literal colours rather than a factor because if you change the weights the colours change and if you give a negative weight you get his error:
If we load ggraph we get a continuous colour scale as expected:
Created on 2021-02-01 by the reprex package (v0.3.0)
Session info
The text was updated successfully, but these errors were encountered: