I'm trying to plot a multiple line graph using ggplot2
. I have a data.table with dates in the format (year-month-day) in the first column. the other columns refer to different strategies and each row has the value that I want to plot. Please see below the image with a screenshot from the data table.
When I plot the graph, I get the image below with no line, just black dots all saturated.
- Is the date format wrong or should I change anything with it?
- The values are similar because they are cumulative returns for each strategy (I have multiplied each value by 100 to resemble a percentage. Is that the issue?
Please have a look at the code I'm using which I adapted from other questions here in Stackoverflow:
cumu<- data.table(cumu)
cumu_f <- cumu %>%
tidyr::gather(Strategy, value, Holding:Positive)
ggplot(cum_f, aes(x = Date, y = value, color = Strategy)) +
geom_line()
I would really appreciate your help on this. I'm sure it is a simple mistake I'm making but I'm new to R and having some issues. Thank you!