Thanks for the previous feedback. This is my question edited with all the comments suggested:
I am trying to plot some data in multiple columns: the total performance of industrial activity for years 2015 to 2018, performance of construction for the same years, performance of manufactures for the same years and so on.
I used some geoms and the best I could achive was a graph with the labels but those are one over the other in each category. The labels are not distributed in each column.
The code that I wrote was the following, considering that the main problem could be in the geom_label part:
Ramo <- c("Total", "Total", "Total", "Total", "Minería", "Minería", "Minería",
"Minería")
Periodo <- as.character(c(2015, 2016, 2017, 2018, 2015, 2016, 2017, 2018))
Valor <- as.numeric(c(0.6087, -0.1573, -0.4233, -2.5450, -3.7347, -7.7113,
-6.6872, -8.3708))
melted <- data.frame(Periodo, Ramo, Valor)
graficaTotal <- ggplot(melted, aes(x = Ramo, y = Valor)) +
geom_col(aes(fill = Periodo), position = "dodge") +
geom_label(aes(x = Ramo, y = Valor,
label = paste0(round(melted$Valor, 1), '%')),
size = 3) +
ggtitle("Actividad Industrial: Variación anual diciembre, cifras originales (%)") +
theme(plot.title = element_text(face = "bold", size = 10, hjust = 0.5)) +
theme(axis.title.x = element_blank(), axis.title.y = element_blank(),
axis.line = element_line(color = "black"),
panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank()) +
geom_hline(yintercept = 0) +
scale_y_continuous(limits = c(-10, 5)) +
theme(legend.position = "bottom") +
theme(legend.title = element_text(size = 7),
legend.text = element_text(size = 7), legend.key.size = unit(0.2, "cm")) +
scale_fill_manual(name = "", values = c("2015" = "2015", "2016" = "2016",
"2017" = "2017", "2018" = "2018"))
print(graficaTotal)
In the end this is a picture of the desired outcome: Possible outcome
Thanks in advance for your help.