0

I am trying to change the x-axis orientation of the bar plot but it does not work. This is the code I am using

res1PM$Source <- "Reserva 1P"
res2PM$Source <- "Reserva 2P"
res3PM$Source <- "Reserva 3P"

reservas_totalesM <- rbind(res1PM, res2PM, res3PM)

aM <- ggplot(reservas_totalesM, aes(x = CAMPO_OFICIAL, y = VOLUMEN_ORIGINAL_PETROLEO_MMB, fill = Source)) +
  geom_bar(stat = "identity", position = position_stack()) +
  labs(x = "Campos", y = "Reservas [MMbls]", fill = "Referencia") +
  ggtitle("Reservas totales de aceite en campos marinos") +
  scale_fill_brewer(palette = "Greens") +
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
  theme(axis.text.x = element_text(angle = 90, hjust = 1)) + 
  theme_minimal()

aM_interactivo <- ggplotly(aM)

aM_interactivo
Miguel JV
  • 67
  • 5
  • Are you trying to change the complete x-axis orientation or just the axis labels? – Jonathan V. Solórzano Jun 08 '23 at 00:26
  • Please [make this question reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by including a small representative dataset in a plain text format - for example the output from `dput(reservas_totalesM)`, if that is not too large. – neilfws Jun 08 '23 at 00:40

0 Answers0