tic clear,clc load links yanlinks=readmatrix('yanlinks_boundary_adjustment'); % for i=1:length(bus) % a=bus(i,:); % a(a==0)=[]; % bus1=findall1(a,station(:,1)); % plot(station(bus1,2),station(bus1,3),'o') % hold on % B{i}=a; % end % bus(bus==0)=[]; % bus1=findall1(bus(2:end),station(:,1)); % plot(station(bus1,2),station(bus1,3)) for i=1:length(yanlinks) links(i,6)=yanlinks(i,12); end groups = unique(links(:, 6)); groups(groups==0)=[]; % 遍历每一组数据,并绘制 for i = 1:length(groups) % 取出当前组别的数据 group_data = links(links(:, 6) == groups(i), :); % 设置不同的颜色 num_groups = max(links(:,6)); colorss = rand(num_groups-6,3); colors = [1,0,0;0.2,0.8,0.3;0,0,0;0.3,0.2,0.7; 0.2,0.6,0.3;0,1,0;0,0,0;0,0,1]; colors = [colors;colorss]; for ii=1:length(group_data(:,1)) line([group_data(ii,1),group_data(ii,3)],[group_data(ii,2),group_data(ii,4)],'LineWidth',2,'Color',colors(i,:)); end end title('15242','fontsize',48,'LineWidth',2) grid on toc