title: Combine Sankeynetwork plot with a normal ggplot
body: <h2>Problem:</h2>
  <p>Is it possible to combine a <code>sankeyNetwork</code> plot and a normal <code>ggplot</code>?</p>
  <p>I've tried using <code>ggarrange</code>, which returns the following error:</p>
  <pre><code>&gt; ggarrange(p1, p2, rremove(&quot;x.text&quot;), ncol = 1, nrow = 2)
  $`1`
  
  $`2`
  
  attr(,&quot;class&quot;)
  [1] &quot;list&quot;      &quot;ggarrange&quot;
  Warning messages:
  1: In as_grob.default(plot) :
    Cannot convert object of class sankeyNetworkhtmlwidget into a grob.
  2: In as_grob.default(plot) :
    Cannot convert object of class themegg into a grob.
  </code></pre>
  <p>and <code>cowplot</code>, which returns the following error:</p>
  <pre><code>&gt; plot_grid(p1, p2, ncol = 1, align = 'v', axis = 'l', rel_widths = c(3,1))
  Warning message:
  In as_grob.default(plot) :
    Cannot convert object of class sankeyNetworkhtmlwidget into a grob.
  </code></pre>
  <p>It seems like in both instances the commands need to work with two grob files but are unable to convert the sankeyNetwork plot into this format.</p>
  <p>Ideally i'd retain the interactive elements of the sankeyNetwork plot as I have about 10 categories in each column of my graph and with each flowing into the next this means 100 flows. As some of these are quite small, but still not insignificant, being able to hover over and highlight them is key for being able to see the patterns between nodes.</p>
  <p>Ultimately I also want the bar chart to be only approximately 1/3 the height of the Sankey plot, and stacked on top.</p>
  <h2>For a reproducible example:</h2>
  <p>You can use this code to make a Sankey plot (<a href="https://www.r-graph-gallery.com/323-sankey-diagram-with-the-networkd3-library.html" rel="nofollow noreferrer">source</a>):</p>
  <pre><code># Load package
  library(networkD3)
   
  # Load energy projection data
  URL &lt;- &quot;https://cdn.rawgit.com/christophergandrud/networkD3/master/JSONdata/energy.json&quot;
  Energy &lt;- jsonlite::fromJSON(URL)
  
   
  # Now we have 2 data frames: a 'links' data frame with 3 columns (from, to, value), and a 'nodes' data frame that gives the name of each node.
  head( Energy$links )
  head( Energy$nodes )
   
  # Thus we can plot it
  p1 &lt;- sankeyNetwork(Links = Energy$links, Nodes = Energy$nodes, Source = &quot;source&quot;,
                Target = &quot;target&quot;, Value = &quot;value&quot;, NodeID = &quot;name&quot;,
                units = &quot;TWh&quot;, fontSize = 12, nodeWidth = 30)
  p1
  </code></pre>
  <p>which produces an interactive version of:
  <a href="https://i.stack.imgur.com/yLbpY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yLbpY.png" alt="enter image description here" /></a></p>
  <p>And this code to make a regular ggplot plot:</p>
  <pre><code>p2 &lt;- ggplot(mpg, aes(class)) + geom_bar()
  p2
  </code></pre>
  <p>which produces:</p>
  <p><a href="https://i.stack.imgur.com/eXbnz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eXbnz.png" alt="enter image description here" /></a></p>