I want to plot 2 scatterplots on top of one another with ggplot
but I am not very familiar with it. I have been trying to follow other examples but the layered approach to this package confuses me.
In bothfrontier_data
I want the first column to be the x variable with respect to the 3rd column and the second column to be the x variable with respect to the 4th column. Also how can I add custom axis titles to this plot and add custom axis ranges?
Thank you
############# GGPLOT TO SHOW BOTH PLOTS SUPERIMPOSED ###################################
bothfrontier_data <- data.frame(std_portfolios_Qts, std_portfolios_Qsi,
All_Portfolio_Returns_Qts, All_Portfolio_Returns_Qsi)
head(bothfrontier_data)
# std_portfolios_Qts std_portfolios_Qsi All_Portfolio_Returns_Qts All_Portfolio_Returns_Qsi
#1 0.8273063 0.8194767 0.3421454 0.3357710
#2 0.8272188 0.8196555 0.3421551 0.3357853
#3 0.8273064 0.8192980 0.3421648 0.3357996
#4 0.8271314 0.8194769 0.3421744 0.3358139
#5 0.8272191 0.8194770 0.3421840 0.3358281
#6 0.8272193 0.8194772 0.3421935 0.3358423
dim(bothfrontier_data)
#[1] 501 4
BothFrontiers <- ggplot(bothfrontier_data, aes(x=std_portfolios_Qts)) +
geom_point(aes(y=All_Portfolio_Returns_Qts), color = "blue") +
geom_point(aes(y=All_Portfolio_Returns_Qsi), color = "red")
plot(BothFrontiers)