Plot Self Organizing Map Pattern Trajectories

조회 수: 3 (최근 30일)
Tyler Smith
Tyler Smith 2016년 9월 19일
댓글: Eb Bed 2018년 3월 28일
I am using SOMs to represent Sea Level Pressure (SLP) data. I am needing to map trajectories (line vectors to each pattern) of the patterns over the existing SOM in order to visualize the evolution of SLP patterns from day to day before particular extreme cold events. I have attached an image I edited in paint just to show what I want to do. The SOM consist of 35 patterns. Therefore, the 6 day trajectory would be as follows, 1,9,3,2,10,17 (with pattern 1 being 6 days before the event and pattern 17 being the day of the event).
  댓글 수: 1
Eb Bed
Eb Bed 2018년 3월 28일
Hello Tyler Smith,
I wonder how you produce the 35 patter using netcdef climate data. I am trying to code similar work but I can't manage the codes as I am new to matlab environmetal typical processing SOm class. I wonder If your template code you used to produce these patter. Thank you for your kindness

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

채택된 답변

Gautham Sholingar
Gautham Sholingar 2016년 9월 23일
Hello Tyler,
I understand that you are trying to annotate the SOM pattern with arrows and text to identify the sorted order. A possible solution is to use basic cropping and image dimensions to create ‘textarrow’ annotations. The following script takes a subset of the image you have presented and given a sorted order goes through the list and plots the arrows and associated text.
Note: the following script treats the order vertically i.e.
5 10
4 9
3 8
2 7
1 6
Please feel free to modify the script below to meet your requirements
close all
clear all
%%Import default figure
% replace this with the default image without annotations
img = imread('trajectory.jpg');
[origHeight,origWidth] = size(img(:,:,1));
%%Determine a clean subset of the image
% it is advisable to crop the image to remove the color map marker on the
% end to start out or add this in later
I2 = imcrop(img,[940 80 origWidth-1200 origHeight]);
%%Get the range of x and y vals where the arrow heads and tails should be located
[cropHeight, cropWidth] = size(I2(:,:,1));
ylocs = cropHeight/5:cropHeight/5:cropHeight;
xlocs = cropWidth/4:cropWidth/3:cropWidth;
[Xvals,Yvals] = meshgrid(xlocs,ylocs)
Xvals = round(Xvals);
yvals = round(Yvals);
% Change the sorted order as needed
SortedOrder = [1 5 8 4 7 12]
%%Annotate and draw arrows according to the order
for i = 1:length(SortedOrder)-1;
h(i) = annotation('textarrow');
h(i).String = [num2str(SortedOrder(i))];
h(i).FontSize = 20;
hold on
h(i).Units = 'pixels';
h(i).X = [Xvals(SortedOrder(i)) Xvals(SortedOrder(i+1))];
h(i).Y = [Yvals(SortedOrder(i)) Yvals(SortedOrder(i+1))];
hold off
% Add the number for the last arrow location
lastAnnot = annotation('textbox');
lastAnnot.String = [num2str(SortedOrder(end))];
lastAnnot.FontSize = 20;
lastAnnot.Units = 'pixels';
lastAnnot.Position = [Xvals(SortedOrder(end)) Yvals(SortedOrder(end)) 20 20];
lastAnnot.LineStyle = 'none';
Output of Script:
This script should be a great place to start annotating your SOM pattern.
  댓글 수: 1
Tyler Smith
Tyler Smith 2016년 9월 23일
Thanks! I can definitely make that work.

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

추가 답변 (0개)


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

Community Treasure Hunt

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

Start Hunting!

Translated by