This is the first time I post a question here, so I hope it works fine!
I'm in the process of building a donut chart. Thanks to the help of several websites, I managed to plot it. However, there is an issue that I don't know how to solve... R asked me to use discrete values. Hence I used factor(variable) to make it work, but now it pops up in the legend and I want it to appear without that info (just HG, no factor(HG) and no a). Please find below the code used and attached a picture of how the graph looks like.
Any idea on how to get rid of it would be appreciated.
ggplot(test, aes(ymax=ymax, ymin=ymin, xmax=4, xmin=3, fill=factor(HG))) +
geom_rect() +
geom_text(x=4.2, aes(y=labelPosition, label=label, color=factor(HG)), size=4) +
scale_fill_manual(values=colores) +
scale_color_manual(values=colores2) +
coord_polar(theta="y") +
xlim(c(1.5, 4)) +
theme_void() +
theme(legend.position = "right") +
ggtitle('TSI per HG') +
theme(plot.title = element_text(hjust = 0.5))*