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!