Plot a table into 16 rectangles
3 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I am trying to plot this table (below) as 16 rectangles of equal size and each of these rectangles FaceColor being the value within the table
3.046095 ¦ 3.065321 ¦ 2.897449 ¦ 2.766175
2.947777 ¦ 3.005672 ¦ 2.878440 ¦ 2.716963
2.865979 ¦ 2.911387 ¦ 2.780432 ¦ 2.529457
2.797027 ¦ 2.761119 ¦ 2.577187 ¦ 2.360562
I had a look through http://stackoverflow.com/questions/16114573/plotting-a-rectangle-with-colour-representing-a-value-in-matlab, but I couldn't find how to use the faceColor and match it with an actual value.
I look for surf and contourf, but neither of them are suitable since they turn this table into 9 rectangles instead of 16.
回答 (3 件)
Iain
2014 年 2 月 10 日
If you want to do it as a proper 3D plot, you're probably best off by building up patch objects.
e.g.
patch([0 1 1 0],[1 1 0 0],[3.046095 3.046095 3.046095 3.046095],3.046095./max_of_the_table)
If you want just an image. imagesc should do the job. "image" will do it with some thought.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Polygons についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!