plotting the outcomes of a matrix

1 view (last 30 days)
Goodmorning all!
I would like to plot the outcomes of my matrix and I need your help on this one.
I've got a matrix, "x1" consisting of portfolio weights over several simulation paths.
So the X-axis are time-steps (1-20), Y-axis are simulation paths (1-10000), and the outcomes are the weights, ranging from 0-1.
What i want to do is to make a time-horizon plot. On the x-axis, I would like to have the time horizon, so 1-20 and on the y-axis the weights, from 0-1.
How should I do this?
Many thanks!
  1 Comment
dpb
dpb on 11 Jun 2013
Only way I'd see in ML handle graphics would be to either a) make a new axis for each series, or b) offset the values by the height differential between series.
But, w/ 10k series, how many pixels do you have vertically on the monitor and therefore, once you reduce that total real estate by the ratio of the axis height to monitor height, how many pixels are there to display each series? Not many, methinks... :)

Sign in to comment.

Accepted Answer

dpb
dpb on 14 Jun 2013
OK, an example of b) above to demonstrate try the following...
N=20;
x=1:100;
L=length(x);
y=rand(N,L)/N;
v=[0:N-1]/N;
y=bsxfun(@plus,v',y);
plot(x,y)
set(gca,'ytick',[0:1/N:1]);
set(gca,'yticklabel',[],'ygrid','on')
Will be line plot for the 20 series scaled to fit an overall axis 0-1 w/ an offset of 1/N between them -- 0.05 in this case for simplicity.
If what you're wanting is an area() chart w/ the red/blue for +/- that I find in some references to a "time-horizon" plot, that's a little more complicated -- as in quite a lot. That will require building the segments of positive/negative sequences and drawing them as separate area plot lines for each time series because otherwise is just a single patch object per line and so can only have a single color. Can be done; needs to be a fairly sophisticated helper function. Worth a feature request it would seem if can't find anything on File Exchange already done.
  2 Comments
dpb
dpb on 14 Jun 2013
OBTW on the way Matlab area() plots work--if you were to scale y as above and plot the array w/ area(), it would stack them and use the colormap from low to high w/ a solid line for the data. It does sorta' show the idea...area() w/o the scaling/shifting does the same thing excepting since the data overlap in magnitude you don't get the separation of individual series nearly as clearly, particularly towards the bottom of the plot area.
Kevin van Berkel
Kevin van Berkel on 16 Jun 2013
Thank you for your helpful explanation!

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Object Properties 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!