Azzera filtri
Azzera filtri

Plot a table into 16 rectangles

3 visualizzazioni (ultimi 30 giorni)
Kent Mey
Kent Mey il 10 Feb 2014
Risposto: Kent,et il 10 Feb 2014
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 Commento
Kent Mey
Kent Mey il 10 Feb 2014
Modificato: Kent Mey il 10 Feb 2014
I'll appreciate any help pointing me in the right direction :):):)

Accedi per commentare.

Risposte (3)

Iain
Iain il 10 Feb 2014
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 il 10 Feb 2014
Actually I only want it as a 2D plot, not 3D plot.
  1 Commento
Iain
Iain il 10 Feb 2014
Then try the imagesc function, like I suggested.

Accedi per commentare.


Kent,et
Kent,et il 10 Feb 2014
thanks, very useful :)

Community Treasure Hunt

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

Start Hunting!

Translated by