필터 지우기
필터 지우기

Plot a table into 16 rectangles

조회 수: 3 (최근 30일)
Kent Mey
Kent Mey 2014년 2월 10일
답변: Kent,et 2014년 2월 10일
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.
  댓글 수: 1
Kent Mey
Kent Mey 2014년 2월 10일
편집: Kent Mey 2014년 2월 10일
I'll appreciate any help pointing me in the right direction :):):)

댓글을 달려면 로그인하십시오.

답변 (3개)

Iain
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.

Kent Mey
Kent Mey 2014년 2월 10일
Actually I only want it as a 2D plot, not 3D plot.
  댓글 수: 1
Iain
Iain 2014년 2월 10일
Then try the imagesc function, like I suggested.

댓글을 달려면 로그인하십시오.


Kent,et
Kent,et 2014년 2월 10일
thanks, very useful :)

카테고리

Help CenterFile Exchange에서 Polygons에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by