How do I make a stacked 3-D bar plot from a 3-D matrix?
6 ビュー (過去 30 日間)
古いコメントを表示
If I have 3-dimensional matrix, how would I plot a bar plot where I want one frame to be a certain level of the 'stacked' bar plot and the next frame stacked on top and so forth?
採用された回答
MathWorks Support Team
2009 年 6 月 27 日
Creating a stacked 3-dimensional bar plot is possible using the BAR3 function. A 2-dimensional matrix is collpased when bar3(x,'stacked') option is used. Starting from a 3-D matrix, we grab the first slice of the 3-D matrix and transpose it into a 2-D matrix. Consequently, feed it into bar3. This process will produce the normal output shown in doc bar3.
Next, access the 'xdata' in the of the current axes children and increment it to shift the bars so when BAR3 is called for the next slice of the 3-D matrix, the columns will not overlap. The attached file bar3_stacked.m demonstrates this process.
The following will create a random set of 3D stacked bars using the bar3_stacked function attached to this solution:
a = rand(3,4,5);
bar3_stacked(a);
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!