title: How to do nested pie chart in R where the outer ring data is a subset of inner ring?
body: <p>A similar question has been asked but left unanswered. I need a pie a nested pie chart that has the outer values as a subset of the inner values. </p>
  
  <p>For example I have a simple data table of CD's I have purchased in the past year, I   want the pie chart to show the number of CD's from each continent the band is from and the outer ring so show the individual countries of each band from the particular continent.</p>
  
  <p><a href="https://i.stack.imgur.com/2K8zF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2K8zF.jpg" alt="PieChart"></a></p>
  
  <p>The hover data for the inside pie chart is correct but the data for the outer ring is misleading.  For instance, Germany has 15 CD's out of the 40 European CD's yet Germany's percentage claims 8.62%.  The German % is true against the total 100% but against the 40 European CD's purchased this year, Germany is 37.5%</p>
  
  <p>I cannot figure out how to either change the data frame to provide these numbers or how to get plotly to do it.</p>
  
  <p>This is a sample of my orignal data set:</p>
  
  <pre><code>    Artist   Album  Year    Country Continent
  1   Myrath  Legacy  2016    Tunisia Asia
  2   Myrath   Sands  2011    Tunisia Asia
  3   Orphaned Shalem 2011    Israel  Asia
  4   Orphaned Unsung 2018    Israel  Asia
  </code></pre>
  
  <p>The pie chart is rendered as:</p>
  
  <pre><code>output$bandChart &lt;- renderPlotly({
  
  
  
          plot_ly(freefilter() ,labels = ~Country, values = ~AlbumCount,
                 showlegend = FALSE
                  ) %&gt;%
  
          add_pie(hole = 0.6,
                  textinfo = 'label',
                  textposition = 'inside',
                  insidetextfont = list(color = '#FFFFFF'),
                  marker = list(line = list(color = '#FFFFFF', width = 1)),
                  direction = 'clockwise',
                  sort = FALSE,
                  text = ~paste(Country, AlbumCount),
                  hoverinfo = 'text + percent') %&gt;%
  
          add_pie(freefilter(),labels = ~Continent, values = ~AlbumCount,
                  textinfo = 'label',
                  textposition = 'inside',
                  direction = 'clockwise',
                  sort = FALSE,
                  name = "Continent Data,
                  marker = list(line = list(color = '#FFFFFF', width = 1)),
                  domain = list(x = c(.2, 0.8), y = c(0.2, .8))
  
                          ) %&gt;%
  
                config (collaborate = FALSE, displaylogo = FALSE ) %&gt;%
  
               layout(title = "Band Locations",
                 xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
                 yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
                 autosize = FALSE)
      })
  </code></pre>
  
  <p>Im using shiny and didn't include those parts of the code.</p>
  
  <p>Thanks</p>