plot efficient frontiers with different colors

2 views (last 30 days)
polar
polar on 21 May 2015
Edited: Adam on 22 May 2015
Hi, I'm following the Mathworks video "Getting started with Portfolio Optimization" and I realized that I can't plot my efficient frontiers with different colors: I mean, each time I add a constraint or compute asset Moments at different conditions, it plots several frontiers with the same color(blue). I've seen on the line 77 of tutorial a script: "format_plots()" but everytime I use it doesn't work. Can u help me understand how to fix several colors? thanks
  2 Comments
Adam
Adam on 21 May 2015
Edited: Adam on 22 May 2015
You need to give more information, in particular which version of Matlab you are using and which version of Matlab the tutorial is using.
Most of us haven't watched that tutorial so giving enough detail here for your question to be self-sufficient would be helpful to get answers as most of us don't have time to watch a random tutorial just to answer what may be a simple question.
In general you can simply specify the colour you want to plot a graph with as e.g.
plot( x, 'Color', [0.5 0.5 1] )
If you are using a post R2014b version of Matlab then successive plots will automatically be given a new colour, but in earlier versions they will not.
polar
polar on 22 May 2015
ok thanks for your answer. The version is R2011b (the one used in the tutorial is R2011a). I know about the code you provided above unfortunately the problem seems more complex. In shorts: 1) I plot the efficient frontier by using: "[prisk, preturns]=p.plotFrontier(10);" So far so good
2) I now need to plot another efficient frontier by adding some constraints and setting equalities conditions. So I copied the code: " p=Portfolio(p,'Aequality',A, 'bEquality',b); "hold on" "p.plotFrontier";
So, what happens in the chart is that it displays two different efficient frontiers (as it should be) but with the same color. How can I make it plot new colors everytime I add a new contraint or set other conditions as done in this example?

Sign in to comment.

Answers (0)

Categories

Find more on Portfolio Optimization and Asset Allocation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!