title: ggnetwork scale edge and node (vertex) size independently (different geoms different scales)
body: <h2>Problem:</h2>
  
  <p>I want to use a different size scale for edges and nodes in a network created with the ggnetwork package. If you look at the image below you may think I already did that since they all have different sizes but in fact edge and node size are not scaled independently in this plot. They are both scaled by the <code>scale_size_area()</code> function towards the same maximum (30).  If I get larger nodes my edges will shrink. I guess my problem boils down to scaling the size of different geoms with different functions. So for example how can I scale the size of the nodes with <code>scale_size_area(max_size = 30)</code> and the size of the edges with <code>scale_size_continuous(range = c(1,6))</code>?</p>
  
  <h2>Example code:</h2>
  
  <pre><code>#load packages
  library(network)
  library(sna)
  library(ggplot2)
  library(ggnetwork)
  
  #create data
  #data for edges
  edge_df&lt;-data.frame(group1=c("A","A","B"),
             group2=c("B","C","C"),
             connection_strength=c(1,2,3))
  
  #data for nodes/vertexes
  vertex_df&lt;-data.frame(group=c("A","B","C"),
                        groupsize=c(2,3,4))
  
  #create network
  my_network&lt;-network(edge_df[,1:2],directed = FALSE)
  
  #add edge attribute (interaction strength) to network object
  set.edge.attribute(my_network, "connection_strength", edge_df$connection_strength)
  
  #add node/vertex info to network object with the special %v% operator
  my_network %v% "groupsize" = vertex_df$groupsize 
  
  #plot
  ggplot(my_network, aes(x = x, y = y, xend = xend, yend = yend,color=vertex.names)) +
    #edge size depends on connection strength
    geom_edges(color = "black",aes(size=connection_strength/20)) +
    #node size depends on groupsize
    geom_nodes(aes(size=groupsize)) +
    #scale size area is good for nodesize but I want a different scaling for the edges
    scale_size_area(max_size = 30,guide=F)+
    scale_color_discrete(guide=F)+#remove colour legend
    scale_x_continuous(limits=c(-0.15,1.15))+#add some space to x-axis
    scale_y_continuous(limits=c(-0.15,1.15))+#add some space to y-axis
    theme_bw()#simple plot layout
  </code></pre>
  
  <h2>Example plot:</h2>
  
  <h2><a href="https://i.stack.imgur.com/ygIj8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ygIj8.png" alt="example network plot"></a></h2>