plot efficient frontiers with different colors

4 次查看(过去 30 天)
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 个评论
Adam
Adam 2015-5-21
编辑:Adam 2015-5-22
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 2015-5-22
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?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Portfolio Optimization and Asset Allocation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by