0

I have created an efficient frontier of some assets and have successfully plotted the results using:

efficient.frontier <- portfolioFrontier()
plot(efficient.frontier,1)

Suppose, I have another portfolio with a mean return = 0.037 and risk = 0.055. I want to visualize this portfolio on the efficient_frontier plot for comparison. I am using the code:

points(y = 0.037, x = 0.055)

However, I get the error

Error in plot.xy(xy.coords(x, y), type = type, ...) : plot.new has not been called yet. 

Could you please let me know what I am doing incorrectly?

  • You provided none of the code you used to lead you to this point, so I ran the demo that this package has for `chart.EfficientFrontierOverlay`. This approach allows me to add points, exactly as you have shown does not work. It looks like you're new to SO; welcome to the community! If you want great answers quickly, it's best to make your question reproducible. This includes sample data like the output from `dput(head(dataObject)))` and any libraries you are using. Check it out: [making R reproducible questions](https://stackoverflow.com/q/5963269). – Kat Apr 03 '22 at 22:12

0 Answers0