and I am trying to create a double layered pie, here is my data:
winner <- c("White" , "draw" , "Black")
lowrated_scotch1 <- c(0.56617647, 0.04411765, 0.38970588) #winrate for Whites,Draws,Blacks in chess
highrated_scotch1 <- c(0.50000000, 0.03676471, 0.46323529)
To give more context, i'm trying to visualize the difference in winrate between whites/draws/blacks for a highrated/lowrated players in Chess for the Scotch opening from the data I already managed to gather.
This is what I have in mind :(image taken from google image)
This is my code :
multi_layer_scotch<-data.frame(winner = c("White","draw","Black"),
Y = c(highrated_scotch),
X = c(lowrated_scotch))
ggplot(multi_layer_scotch, aes(x = X, y = Y, fill = winner))+
geom_bar(stat = "identity")+
scale_fill_manual(values = c("#769656","#baca44","#eeeed2"))+
coord_polar(theta="y")+
theme_void()
and this is what i'm getting as an output :
my marvelous not complete graph
As you can see, the graph isn't layered the way I want. The 3 layers from my plot should be assembled in one layer (to represent the lowrated payers) stacked with another layer (representing the highrated players).
I tried to follow the solution given in this post , but I couldn't manage to do it myself, I felt like it was a little incomplete : Multi-level Pie Chart in R
I'de be glad if you could help me with this! thanks in advance
did you mean something like this:
df1 <- melt(multi_layer_scotch)
ggplot(df1, aes(x = variable, y = value, fill = winner))+
geom_bar(stat = "identity")+
coord_polar(theta="y")