How can I color the external hexagon of each patch when I use "plotsomhits"?

1 回表示 (過去 30 日間)
Fatjona Gjikopulli
Fatjona Gjikopulli 2023 年 5 月 6 日
回答済み: Varun 2023 年 5 月 16 日
Hi! I would like to know how can I change the color of the external hexagon for each patch when I obtain the Hits using the function "plotsomhits".
I proceeded in this way but in this case only the internal hexagon is colored, not the external one.
plotsomhits(net,x)
patches = findobj(get(gca,'Children'),'Type','Patch');
set(patches(1:100),'FaceColor',[0 0.4470 0.7410]);
In the attachments the result in .jpg.

回答 (1 件)

Varun
Varun 2023 年 5 月 16 日
I ran your code snippet for the “iris_dataset” taken from this example: https://www.mathworks.com/help/deeplearning/ref/plotsomhits.html#bt5s_mh and observed that the “patches” object contains double the number of neurons in the SOM. Here is the code snippet:
x = iris_dataset;
net = selforgmap([5 5]);
net = train(net,x);
plotsomhits(net,x)
patches = findobj(get(gca,'Children'),'Type','Patch');
set(patches(1:25),'FaceColor',[0 0.4470 0.7410]);
set(patches(26:50),'FaceColor',[1 0.4470 0.7410]);
Here, tThe dimensions passed to the “selforgmap” are [5 5] which mean, there are 25 neurons in the map. However, the variable “patches” is an array of 50 patch objects. So, in the “patches” array, the first 25 patch objects represent the internal hexagons, while the next 25 objects represent the external hexagons, which led me to the following result:

カテゴリ

Help Center および File ExchangePolygons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by