title: How to manually customize edge color and arrows in ggraph?
body: <p>I am trying to visualize a network while customizing some styles. I have not succeeded in the task up to now.</p>
  <p><strong>Requirements:</strong></p>
  <ul>
  <li>Only edges with a weight of 2 should have an arrow pointing in the direction of the link.</li>
  <li>An edge should be of the same colour as the node it is departing from.</li>
  </ul>
  <p><strong>Code:</strong></p>
  <pre class="lang-r prettyprint-override"><code>library(ggraph)
  library(igraph)
  library(graphlayouts)
  library(tibble)
  library(dplyr)
  
  nodes &lt;- data.frame(name = c('a','b','c','d','e')) 
  
  links &lt;- data.frame(
    from = c('a', 'b', 'd', 'a', 'd', 'a', 'c'),
    to = c('b', 'd', 'e', 'c', 'a', 'e', 'e'),
    weight = c(1, 1, 2, 2, 2, 1, 2),
    linetype = c('dashed', 'dashed', 'solid', 'solid', 'solid', 'dashed', 'solid')
  )
  
  
  tbl_graph_net &lt;- as.igraph(tidygraph::tbl_graph(nodes = nodes, edges = links))
  
  layout &lt;- create_layout(tbl_graph_net, 
                          layout = 'igraph', 
                          algorithm = &quot;nicely&quot;)
  
  colfunc &lt;- colorRampPalette(c(&quot;blue&quot;, &quot;red&quot;))
  cols &lt;- colfunc(5)
  
  ggraph(tbl_graph_net, layout = &quot;stress&quot;) +
    # Edges
    geom_edge_fan(aes(colour = from, 
                      edge_width = weight, 
                      linetype = linetype)) +
    scale_edge_linetype_manual(limits = as.factor(links$linetype), 
                               values = links$linetype) +
    scale_edge_colour_gradient(low = &quot;blue&quot;, high = &quot;red&quot;) +
    # Nodes
    geom_node_point(colour = cols, size = 10) +
    # Labels
    geom_node_text(aes(label = name), 
                   size = 7, 
                   colour = &quot;#FFFFFF&quot;) +
    # Theme
    theme_graph() +
    theme(legend.position = &quot;none&quot;)
  
  </code></pre>
  <p>I am aware of the existence of <code>scale_edge_color_manual</code> but don't know how to correctly use it. Similarly, I don't know if I am scaling the nodes' colours correctly with <code>scale_color_manual</code>.</p>
  <p>Matching edge and node colours should be definitely possible, but I have no idea of how to draw an arrow <strong>only on some</strong> edges. If <code>ggraph</code> does not allow it, I am happy to accept another solution with <code>igraph</code> or something similar.</p>
  <p><strong>EDIT:</strong></p>
  <p>I managed to apparently match edge and node colour. Code is updated. Only arrows are missing</p>