How do I make the legend of each curve appear in the graphic print area?

Asked

Viewed 41 times

0

grafico <- read.csv("Pasta1.csv", header = F, sep = ";")

library(ggplot2)

Experimental <- ggplot(grafico)+
  geom_line(size=1.2, aes(x=V1, y=V2))+
  scale_fill_manual(values = c("Experimental" = "green", "nulo" = "null"))

angulo30 <- Experimental+
  geom_line(size=1, col="blue", aes(x=V3, y=V4))

angulo36 <- plot30+
  geom_line(size=1, col="red", aes(x=V5, y=V6))

angulo42 <- plot36+
  geom_line(size=1, col="green", aes(x=V7, y=V8)) +
  labs(x="Displacement (mm)", y="Load (kN)")+
  theme_bw(base_size = 12)+
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())+
  theme(axis.text.x = element_text(color = "black", size = 12), axis.text.y = element_text(color = "black", size = 12))

angulo42

inserir a descrição da imagem aqui

  • 3

    Welcome to Stackoverflow! Unfortunately, this question cannot be reproduced by anyone trying to answer it. Please take a look at this link (mainly in the use of function dput) and see how to ask a reproducible question in R. So, people who wish to help you will be able to do this in the best possible way.

  • 1

    Hello Paul. You need to put color inside aes. Check these posts: https://answall.com/questions/41503/como-colocarlegenda-em-graficos-de-distribui%C3%A7%C3%b5es-no-ggplot e https://answall.com/questions/363454/legenda-no-gg-plotn%C3%a3o-aparece

  • Thanks, @Carloseduardolagosta! I got it!

  • I am happy. If it was the other posts that helped you solve, I recommend deleting your question, so there is no duplication within the OS.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.