Good day,
I need to prepare a graph showing the proportions of the various biomass components, but it is showing ,1 after each component in the legend in R, Ggplot2. I only want to see the list of components in the legend without the ,1 after each entry. See below the sample data, the code I have used and the graph with the unwanted mistake.
Also, the graph shows that the components(Cone, needle, bark, branch) are increasing with an increase in DBH, while they should be decreasing. Only stem increase with an increase in DBH.
Sample data:

Component_order <- c("Cone", "Needle", "Bark", "Branch", "Stem")
colours_order <- c("deepskyblue", "darkslategrey", "darkseagreen", "deeppink2", "darksalmon")
DRProportions$Component <- factor(DRProportions$Component, levels = Component_order)
plotly::ggplotly(
ggplot(DRProportions[order(DRProportions$Component),], aes(x = DBH, y = Percentage, fill = Component)) +
geom_area(alpha=0.6 , linewidth=.5, colour="white") +
scale_colour_manual("", values = c(Cone="deepskyblue", Needle="darkslategray", Bark="darkseagreen", Branch="deeppink2", Stem="darksalmon"))+
labs(y="Percentage (%)", x="DBH (cm)")+
theme(axis.text = element_text(size = 14))+
theme(axis.title = element_text(size = 15))+
theme(legend.text = element_text(size = 15)))
Graph with mistake:

I have rearranged the order of the legend entries with the associated colors assigned to them. That is where the ,1 error slipped in. Don't know how to modify the code further to get rid of the ,1. Also, all components shows an increasing order, while it should be only stem.


The issue is that you map on the
fillaes but add a manual color scale. Instead, switch toscale_fill_manualto apply your custom colors and to get your desired legend labels.Using some fake random example data: