I have a four-dimensional dataset, let's call the variables x, y, z and r. There is at most one entry for each combination of x and y. Currently, I have a scatterplot where I plot for each entry a point at position (x,y) and size z.
ggplot(aes(x=x,y=y)) + geom_point(aes(size=z))
This produces a nice plot, but now I would like to "upgrade" it as follows: I want to replace each point with a piechart, and the piechart should be the same size as the point. The pie consists of two sections, one blue, and orange, taking up a proportion of r of the pie (r always being between 0 and 1).
Any ideas on how to do this elegantly?
Cheers