title: linear graph with specific scale for nodes in ggraph R
body: <p>I'm experimenting with the outstanding ggraph library to depict some really-hard to depict interrelationships for a scientific work. Specifically, I want to show SNP-SNP interactions in a genetic locus. It would be very nice if I plotted the interactions as curved nodes of a graph, where the SNPs are positioned in a linear fashion according to their genetic positions. The geom_edge_arc() aesthetics from the ggraph library would be ideal. However, I cannot put the nodes in an order according to the positions.</p>
  
  <p>Here is an example</p>
  
  <pre><code>library(igraph)
  library(tidyverse)
  library(ggraph)
  
  set.seed(10)
  nodes &lt;- tibble(nodes = paste("SNP",seq(1:10)), pos = sample(c(10000:20000),10))
  edges &lt;- expand.grid(nodes$nodes,nodes$nodes) %&gt;% 
                mutate(interaction = rnorm(100)) %&gt;%
                filter(abs(interaction)&gt;1)
  
  gr &lt;- graph_from_data_frame(edges, vertices = nodes)
  
  ggraph(gr, 'linear', circular=F) +
    geom_edge_arc(aes(edge_width=interaction)) 
  </code></pre>
  
  <p>The nodes are evenly spaced here, as "factors". However, I wanted to place them on the x coordinate as specified by the <code>pos</code> variable (which in turn becomes an attribute of the nodes). Adding <code>+ geom_node_point(aes(x=pos))</code>to the ggplot object doesn't result in a correct rendering. I could probably do the plot with "basic" ipgraph too, but I like ggraph and ggplot2, and it would be an elegant and easy way to plot with this.</p>
  
  <p>Kind regards, and thanks in advance,</p>
  
  <p>Robert</p>