Days Profit
4672 5195 79823.72824
4673 5196 79823.72824
4674 5197 79823.72824
4675 5198 79823.72824
4676 5199 79823.72824
4677 5200 79823.72824
4678 5201 79823.72824
4679 5203 77760.56168
4680 5204 77760.56168
4681 5205 77760.56168
4682 5206 77760.56168
4683 5207 77760.56168
4684 5212 85379.47144
4685 5213 85379.47144
4686 5214 85379.47144
4687 5215 85379.47144
4688 5216 85379.47144
Above is an example of the data frame that I created, I only posted a small chunk of it as it is around 7000 rows. I am trying to create a line graph with the data using ggplot. The graphs that I see others post look very nice and professional but when I created mine it was not. Below you will see how I used ggplot and my graph result.
df <- data.frame(Days = Day_value, Profit = PnL_value)
p <- ggplot(data=df, aes(x=Days, y=Profit)) + geom_line() + geom_point()
The graph below is the print of my entire data set and not just the select data I shared. One thing to notice is that my Days column does not always increment by 1.
I would ideally have my graph look like this one with only 1 line instead of 3. Ideal Graph
When I check the Structure I get:
'data.frame': 6993 obs. of 2 variables:
$ Days : Factor w/ 6993 levels "100","1000","1001",..: 4180 4286 4397 4489 4598 4699 4810 4910 5008 5111 ...
$ Profit: num 0 0 0 0 0 0 0 0 0 0 ...
NULL
When I run it I also get this error:
geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?