title: Plotly: Bar and pie charts side by side
body: <p>I would like to plot a bar and a pie chart side by side using the <code>subplot</code> function in the <code>plotly</code> package in R. However, a big pie chart is plotted in the center of the graph, overlaying the bar plot. </p>
  
  <p>Here is a sample code:</p>
  
  <pre><code>Animals &lt;- c("giraffes", "orangutans", "monkeys")
  SF_Zoo &lt;- c(20, 14, 23)
  LA_Zoo &lt;- c(12, 18, 29)
  data &lt;- data.frame(Animals, SF_Zoo, LA_Zoo)
  
  bar &lt;- plot_ly(data, x = ~Animals, y = ~SF_Zoo, type = 'bar') %&gt;%
    layout(yaxis = list(title = 'Count'), barmode = 'stack')
  
  pie &lt;- plot_ly(data, labels = ~Animals, values = ~LA_Zoo, type = 'pie', hole = 0.6)
  
  subplot(bar, pie)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/lRVaz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lRVaz.png" alt="enter image description here"></a></p>
  
  <p>How can I fix it?</p>