I have a group of plots currently created in Base R using the code below
plot(PWR_Sports_Racing$`Running P&L`, type="l",col=4, xlab="Bets",ylab="Profit", main = "Racing YTD P&L")
par(new=T)
plot(PWR_Sports_Racing$`BFSP Running P&L`,type = "l",col=2, xlab = "",ylab = "",axes = F)
legend("topright",legend = c("P&L","BFSP P&L"),lty=c(1,1),col=c(4,2))
I would like to convert these to plots created with ggplot2 however when I try to get them to work the output looks worse.
This is where I have got
ggplot(data = PWR_Sports_Racing) +
geom_line(mapping = aes(,y=PWR_Sports_Racing$`Running P&L`))+
ylab("Profit") +
xlab("Date")
I presume it is something to do with multiple results on each day
Might help if I show some data,
Here is some of the data for you to get an idea
PWR_Sports_Racing <- structure(list(dmydate = c(43836, 43837, 43837, 43838, 43838,
43838, 43839, 43839, 43839, 43839, 43839, 43840, 43840), Selection = c("Fantastic Flyer",
"Cold Harbour", "Directory", "Corinthia Knight", "Sound Mixer",
"Prince Ofd Rome", "Ekhtiyaar", "North America", "Melgate Majeure",
"Marhaban", "Social City", "Reeves", "Flowery"), Country = c("UK",
"UK", "UK", "UK", "UK", "UK", "UAE", "UAE", "UK", "UAE", "UK",
"UK", "UK"), Time = c("7.45pm", "4.15pm", "5.45pm", "2.30pm",
"5.15pm", "7.45pm", "3.05pm", "5.25pm", "3.30pm", "4.50pm", "6.00pm",
"1.10pm", "2.00pm"), Course = c("Wolverhampton", "Southwell",
"Southwell", "Newcastle", "Kempton", "Kempton", "Meydan", "Meydan",
"Newcastle", "Meydan", "Chelmsford", "Lingfield", "Sedgefield"
), Race.Type = c("AWFT", "AWFT", "AWFT", "AWFT", "AWFT", "AWFT",
"AWFT", "AWFT", "AWFT", "AWFT", "AWFT", "AWFT", "CHS"), Race.Type.2 = c("Hcap",
"Hcap", "Hcap", "Cond", "Hcap", "Am Hcap", "Hcap", "Group 2",
"Hcap", "Hcap", "Hcap", "Hcap", "Hcap"), Stake = c(20, 20, 20,
20, 20, 20, 20, 40, 20, 20, 20, 20, 20), Stake.Points = c(1,
1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1), `E/W` = c("N", "N", "N",
"N", "N", "N", "N", "N", "N", "N", "N", "N", "N"), Total.Points = c(1,
1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1), Odds = c(4.3, 5.2, 2.72,
9.8, 2.8, 4.2, 2.6, 2.3, 8.2, 8.2, 10, 4.6, 5.5), BFSP = c(4.63,
4.6, 2.7, 11.5, 3.5, 9.33, 2.16, 2.5, 5.45, 8.8, 11.2, 5.58,
7.6), Result = c("L", "W", "L", "L", "L", "L", "W", "L", "L",
"L", "W", "W", "L"), Commision = c(0.05, 0.05, 0.05, 0.05, 0.05,
0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05), Payout.1 = c(0,
104, 0, 0, 0, 0, 50.4, 0, 0, 0, 191, 88.4, 0), `Loss/Profit` = c(-20,
84, -20, -20, -20, -20, 30.4, -20, -20, -20, 171, 68.4, -20),
Payout.2 = c(0, 92, 0, 0, 0, 0, 42.04, 0, 0, 0, 213.8, 107.02,
0), `Loss/Profit.BFSP` = c(-20, 72, -20, -20, -20, -20, 22.04,
-20, -20, -20, 193.8, 87.02, -20), `Running.P&L` = c(-20,
64, 44, 24, 4, -16, 14.4, -5.6, -25.6, -45.6, 125.4, 193.8,
173.8), `BFSP.Running.P&L` = c(-20, 52, 32, 12, -8, -28,
-5.96, -25.96, -45.96, -65.96, 127.84, 214.86, 194.86)), row.names = c(NA,
13L), class = "data.frame")