Hello everybody,
I have two dataframes and I'd like to put them on the same scatterplot ggplot. However, I'd like to display the names of the point (third column of both dataframes) , but only for the points belonging to the "df2" data.frame. Is it possible ? Here's my code and my dataframes.
Thanks you for reading !
Robin
########################################################################################
df1<-data.frame("Rendement" = c(0.1,0.15,0.2), "Risque" = c(0.05,0.03,0.15), "Name" = c("Fufu","Wayowayo","Otacos"))
df2<-data.frame("Rendement" = c(0.12,0.11,0.25), "Risque" = c(0.14,0.0325,0.17), "Name" = c("Pictet","Interselection","Carlton"))
p <- ggplot(NULL, aes(Risque,Rendement), label = Name)+
geom_point(data = df1, colour = "orange", size = 2)+
geom_point(data = df2, colour = "blue", size = 2)+
expand_limits(x = 0, y = 0)+
labs(title = 'Frontiere efficiente', x = 'Volatilite journaliere', y = 'Rendement journalier ')+
scale_y_continuous(labels = percent)+
scale_x_continuous(labels = percent)+
theme(plot.title = element_text(face = 'bold.italic', hjust = 0.5))
ggplotly(p)
################################################################################