I'm having a lot of problems creating a legend for a bar plot in ggplot2.
The plot is fine, but the legend writes all the labels as if they were Python's tuples (i.e. (id1, 1, NA) ). I cannot explain why this is happening since that's not how they are written in the data and I'm having a hard time modifying them.
Has anybody seen this behavior before? How could I fix it?
I am sorry I couldn't provide a reprex, the actual data I'm using contains sensitive information that I can't share.
However, you are right, the code I provided is correct. My problem occurred because I was trying to render a ggplot using the renderPlotly function in Shiny, which I never considered as possible cause of the problem.
Changing it to renderPlot (and accordingly the plotlyOutput element to plotOutput) solved the problem.