I have this code:
p <- ggplot(dataset, aes(x =i, y = um)) +
geom_point()
p <- p + geom_line(aes(y = EXPMEDIA, colour = "EXP"))+ geom_line(aes(y = simple, colour = "simple"))
p <- p + scale_y_continuous(sec.axis = sec_axis(~.*1, name = ""))
p<- p + scale_colour_manual(values = c("blue", "red"))
p <- p + labs(y = "UMIDADE ",
x = "DATES ",
colour = "Legenda")
p <- p + theme(legend.position = c(0.955, 0.95)) +
ggtitle(" Exponential Moving Average ")
p
I need plot in this graphic the last value of last<=tail(dataset$EXPMEDIA, n=1) how i can plot this value in the graphic ?
Hi @rafael,
Might you be able to post a reproducible example with a bit of data? That way we can see what's happening at each step— it's hard to envision what you've got going on (at least for me) without seeing the output or the input!
I tend to feel that if you start from the general principle that ggplot is about columns preforming jobs when making graphs, there is normally one solution by have what you want in a column- so setting up the data then using ggplot to generate a figure from it