Simple concept, unexpectedly confusing. I have a graph like this:
What I want to do is to replace the letters with small images (paintings, actually; so one painting for 'a', another for 'b', and so on).
Relevant code:
mydata <- read.xlsx("C:/...", 1)
plotdata = mydata[1:22,1:2]
v1 = plotdata[1:22, 1] # categorical labels which we can hopefully replace with images
v2 = plotdata[1:22, 2]
distance_plot <- ggplot(plotdata, aes(x = v1, y = v2)) +
geom_bar(stat = "identity", position = "dodge") +
xlab("") + ylab("") +
theme(axis.ticks = element_blank(), axis.text.y = element_blank(),
panel.background = element_blank(), panel.grid.major.x = element_line(colour="grey"),
axis.text.x = element_text(size = 20), legend.title=element_blank())
distance_plot + coord_polar(theta = "x")
Custom annotations don't work with polar coordinates. :( I've also tried just plotting one value (just as a proof of concept/to see if I could get it working) where the x value is an image, but this gave the following error:
Error: Aesthetics must be either length 1 or the same as the data (1): x
Bonus Q (but less important): how to insert each y-value either on top of the lines currently pointing to each label, or above each label, etc.?
I'm new to R as well so please take any less-than-optimal code with a grain of salt. :)