show a digit matrix with segmentation line

Antworten (1)

Benjamin Großmann
Benjamin Großmann am 30 Apr. 2021
Bearbeitet: Benjamin Großmann am 30 Apr. 2021

0 Stimmen

matrix = [ 1 1 1 1 2 2 2 2;
1 1 1 2 2 2 2 2;
3 3 3 3 3 2 2 2;
3 3 3 3 3 3 3 3];
heatmap(matrix, 'Colormap', [1 0 0; 0 0 1; 0 1 0]) % <-- EDIT: colormap definition in heatmap function call changed
colorbar('off')

2 Kommentare

HG
HG am 4 Mai 2021
I want to show a matrix like this photo with black line boundaries.
how can I do this ?
You can use patch() with properties 'FaceColor' and 'EdgeColor' to plot colored surfaces with black line boundaries.

Melden Sie sich an, um zu kommentieren.

Gefragt:

HG
am 30 Apr. 2021

Bearbeitet:

HG
am 18 Mai 2021

Community Treasure Hunt

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

Start Hunting!

Translated by