Hello all,
I'm trying to make a nice plot with ggplot2. On the x-axe I have dates and on the y-axe I have a price. My problem is that all the coordonates appear on the graph, and it makes them impossible to read :
How can I fixe that ? Here's the code :
#Onglet Backtesting
output$backtest<-renderPlotly({
valoPF<-valoPF() #the data
p<-ggplot(valoPF, aes(x = date, y = valeur, group = 1))+
geom_line()+
expand_limits(x = 0, y = 0)+
scale_color_manual(values = c("#00AFBB")) +
labs(x = "temps", y = "Valorisation", title = "Valorisation du portefeuille dans le temps")+
theme_economist()+
scale_colour_economist()
ggplotly(p)
})
Edit : I have a second problem. I use the same dataset but I want it to be 100-rebased ; so I do :
rebase<-valoPF[1,1] #is the first price of my dataset
for (i in 1:nrow(valoPF)){
valoPF[i,1] <-round((valoPF[i,1]/rebase)*100,2)
}
valoPF<-cbind(df[-1,1],valoPF)
colnames(valoPF)<-c("date","valeur")
valoPF<-as.data.frame(valoPF)
p<-ggplot(data = valoPF, aes(x = date, y = valeur, group = 1)) +
geom_line(color = "#00AFBB", size = 1)+
theme(axis.text.x = element_blank(), axis.ticks = element_blank(),
axis.line = element_line(color = "darkblue", size = 1, linetype = "solid"))
print(p)
Finally I got this plot :
Why is my y-axe like this ? And how can I fixe it ?
Thanks for reading,
Robin