text: user2247: I am trying to plot scatter plot of pie charts using ggplot2 and ggforce.
  Following is my code
  library(data.table)
  library(ggplot2)
  library(ggforce)
  library(dplyr)
  
  df <- fread("data_frame_pie_plot.csv", header = TRUE, 
          data.table = FALSE, stringsAsFactors = FALSE)
  
  req_data <- apply(df, 1, function(x){
    geom_arc_bar(aes(x0 = x0, y0 = y0, r0 = 0, r = 0.45, 
                 amount = amount, fill = discrete_fill), stat = "pie")})
  
  ggplot(df) + req_data + theme_no_axes()
  
  plot_obtained
  Link_to_data Data_frame.
  Can I fill the colours manually (discrete(based on discrete_fill column) 
  and continous (based on conti_fill column))?
  I have tried the following codes.
  ##================================================================================##
  # Code 1
  my_colors <- c("red","white","blue")
  ggplot(df, fill = sample_mut_colour) + req_data +
    theme_no_axes() + scale_color_manual(values=my_colors)
  
  ##================================================================================##
  # Code 2
  my_colors_1 <- c("red", "white")
  my_colors_2 <- c("blue", "white")
  
  req_data <- apply(df, 1, function(x){
    geom_arc_bar(aes(x0 = x0, y0 = y0, r0 = 0, r = 0.45, 
                 amount = amount, 
                 fill = discrete_fill,
                 color = case_when(discrete_fill == 1 ~ my_colors_1,
                                   discrete_fill == 2 ~ my_colors_2)), stat = "pie")})
  
  ggplot(df) + req_data + theme_no_axes() 
  
  ##================================================================================##                  
  # Code 3
  req_data <- apply(df, 1, function(x){
    geom_arc_bar(aes(x0 = x0, y0 = y0, r0 = 0, r = 0.45, 
                 amount = amount, 
                 fill = case_when(discrete_fill == 1 ~ my_colors_1,
                                   discrete_fill == 2 ~ my_colors_2)), stat = "pie")})
  
  ggplot(df) + req_data + theme_no_axes() 
  
  ##================================================================================##             
  # Code 4
  req_data <- apply(df, 1, function(x){
    geom_arc_bar(aes(x0 = x0, y0 = y0, r0 = 0, r = 0.45, 
                 amount = amount, 
                 fill = discrete_fill),
             palette = case_when(discrete_fill == 1 ~ "red",
                                 discrete_fill == 2 ~ "black",
                                 TRUE ~ "white"), stat = "pie")})
  
  ggplot(df) + req_data + theme_no_axes()  
  
  ##=================================================================================##
  
  But they do not seem to work. Any idea what is wrong in the code?
  
  user4980: For a discrete scale your Code 1 example was nearly there.  Just use scale_fill_manual instead of scale_color_manual.  For more control over how the discrete values map to color values you can name the vector, too.
  my_colors <- c("red","white","blue")
  ggplot(df) + req_data +
      theme_no_axes() + scale_fill_manual(values=my_colors)
  # or, if you want consistent output independent of the order of
  # df$discrete_fill:
  my_colors <- c("1" = "red", "2" = "white", "dummy" = "blue")
  ggplot(df) + req_data +
      theme_no_axes() + scale_fill_manual(values=my_colors)
  
  You can also just use a single call to geom_arc_bar for the whole data frame (rather than a list of call results from each row) and you'll get the same effect.
  ggplot(df) +
    geom_arc_bar(aes(x0 = x0, y0 = y0, r0 = 0, r = 0.45, 
                 amount = amount, fill = discrete_fill), stat = "pie") +
      theme_no_axes() + scale_fill_manual(values=my_colors)
  
  
original_text: 2247: <p>I am trying to plot scatter plot of pie charts using ggplot2 and ggforce.
  Following is my code</p>
  
  <pre><code>library(data.table)
  library(ggplot2)
  library(ggforce)
  library(dplyr)
  
  df &lt;- fread("data_frame_pie_plot.csv", header = TRUE, 
          data.table = FALSE, stringsAsFactors = FALSE)
  
  req_data &lt;- apply(df, 1, function(x){
    geom_arc_bar(aes(x0 = x0, y0 = y0, r0 = 0, r = 0.45, 
                 amount = amount, fill = discrete_fill), stat = "pie")})
  
  ggplot(df) + req_data + theme_no_axes()
  </code></pre>
  
  <p>plot_obtained<a href="https://i.stack.imgur.com/Y2m1Z.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y2m1Z.jpg" alt="plot_obtained"></a>
  Link_to_data <a href="https://drive.google.com/file/d/1cB8PJVXTVptuNxIrkcxaxsQ-mSWg9BqO/view?usp=sharing" rel="nofollow noreferrer">Data_frame</a>.<br>
  Can I fill the colours manually (discrete(based on discrete_fill column) 
  and continous (based on conti_fill column))?
  I have tried the following codes.</p>
  
  <pre><code>##================================================================================##
  # Code 1
  my_colors &lt;- c("red","white","blue")
  ggplot(df, fill = sample_mut_colour) + req_data +
    theme_no_axes() + scale_color_manual(values=my_colors)
  
  ##================================================================================##
  # Code 2
  my_colors_1 &lt;- c("red", "white")
  my_colors_2 &lt;- c("blue", "white")
  
  req_data &lt;- apply(df, 1, function(x){
    geom_arc_bar(aes(x0 = x0, y0 = y0, r0 = 0, r = 0.45, 
                 amount = amount, 
                 fill = discrete_fill,
                 color = case_when(discrete_fill == 1 ~ my_colors_1,
                                   discrete_fill == 2 ~ my_colors_2)), stat = "pie")})
  
  ggplot(df) + req_data + theme_no_axes() 
  
  ##================================================================================##                  
  # Code 3
  req_data &lt;- apply(df, 1, function(x){
    geom_arc_bar(aes(x0 = x0, y0 = y0, r0 = 0, r = 0.45, 
                 amount = amount, 
                 fill = case_when(discrete_fill == 1 ~ my_colors_1,
                                   discrete_fill == 2 ~ my_colors_2)), stat = "pie")})
  
  ggplot(df) + req_data + theme_no_axes() 
  
  ##================================================================================##             
  # Code 4
  req_data &lt;- apply(df, 1, function(x){
    geom_arc_bar(aes(x0 = x0, y0 = y0, r0 = 0, r = 0.45, 
                 amount = amount, 
                 fill = discrete_fill),
             palette = case_when(discrete_fill == 1 ~ "red",
                                 discrete_fill == 2 ~ "black",
                                 TRUE ~ "white"), stat = "pie")})
  
  ggplot(df) + req_data + theme_no_axes()  
  
  ##=================================================================================##
  </code></pre>
  
  <p>But they do not seem to work. Any idea what is wrong in the code?</p>
   4980: <p>For a discrete scale your Code 1 example was nearly there.  Just use <code>scale_fill_manual</code> instead of <code>scale_color_manual</code>.  For more control over how the discrete values map to color values you can name the vector, too.</p>
  
  <pre class="lang-r prettyprint-override"><code>my_colors &lt;- c("red","white","blue")
  ggplot(df) + req_data +
      theme_no_axes() + scale_fill_manual(values=my_colors)
  # or, if you want consistent output independent of the order of
  # df$discrete_fill:
  my_colors &lt;- c("1" = "red", "2" = "white", "dummy" = "blue")
  ggplot(df) + req_data +
      theme_no_axes() + scale_fill_manual(values=my_colors)
  </code></pre>
  
  <p>You can also just use a single call to geom_arc_bar for the whole data frame (rather than a list of call results from each row) and you'll get the same effect.</p>
  
  <pre class="lang-r prettyprint-override"><code>ggplot(df) +
    geom_arc_bar(aes(x0 = x0, y0 = y0, r0 = 0, r = 0.45, 
                 amount = amount, fill = discrete_fill), stat = "pie") +
      theme_no_axes() + scale_fill_manual(values=my_colors)
  </code></pre>
  