0
I’m trying to generate a graph of 19-station IQA monitoring stations. But when I graph the order of the groups are wrong, because they are like this: 1, 10, 11 , 12, 13, 14, 15, 16, 17,18, 19, 2, 3, 4, 5, 6, 7, 8, 9.
follows my code
IQA_2005<-quali3%>%
select(Estacao2, IQA, Ano, Ano2, Epoca)%>%
filter(Ano2=="2005-01-01")
ggplot(data=IQA_2005, aes(x=as.factor(Estacao2), y=IQA, fill=as.factor(Epoca)))+
geom_col(position = "dodge", width=0.7)+
scale_fill_manual(values=c("#08088A","#9F81F7"))+
theme_light()+labs(fill="Período Chuvas", title ="Média IQA 2005", x="Estação", y="IQA Médio 2005")+
theme(axis.text.x = element_text(angle = 90))+
geom_hline(aes(yintercept = 51, linetype = "51"), colour = "green", size=1.5) +
scale_linetype_manual(name ="IQA BOM", values = c('solid'))
I tried to use as.factor(Estacao2)
but I was unsuccessful
output graph:
Try to use
x = factor(Estacao2, levels = 1:19)
within theaes
of the graph.– Marcus Nunes
Thank you @Marcusnunes was exactly what I got. It got in the right order now.
– wesleysc352
Excellent! I put the answer below to get registered for questions from other users in the future.
– Marcus Nunes