
Customize scatter figure with subplot
    조회 수: 2 (최근 30일)
  
       이전 댓글 표시
    
Hi, I have the following code that generates a plot like this:
close all; clc
labels = {'K_p' 'K_d' 'K_i' 'M_p'};
data = rand(7,4);
cmap = lines(7);
for i = 1 : 3
    subplot(2,3,i)
    scatter(data(:,i),data(:,4),[],cmap,'filled')
end
data = rand(7,4);
for i = 1 : 3
    subplot(2,3,i+3)
    scatter(data(:,i),data(:,4),[],cmap,'filled')
end

And I need to modify it to create something like this:

And I would also like all the axes to be as close as possible to each other
댓글 수: 0
채택된 답변
  Ameer Hamza
      
      
 2020년 11월 11일
        
      편집: Ameer Hamza
      
      
 2020년 11월 11일
  
      Try this
close all; clc
labels = {'K_p' 'K_d' 'K_i'};
cmap = lines(7);
data = rand(7,4);
for i = 1 : 3
    subplot(2,3,i);
    scatter(data(:,i),data(:,4),[],cmap,'filled');
    if i == 1
        ylabel('ts', 'FontSize', 22);
    end
    if i > 1
        yticklabels([]);
    end
end
data = rand(7,4);
for i = 1 : 3
    subplot(2,3,i+3)
    scatter(data(:,i),data(:,4),[],cmap,'filled');
    if i == 1
        ylabel('M_p', 'FontSize', 22);
    end
    xlabel(labels{i}, 'FontSize', 22);
    if i > 1
        yticklabels([]);
    end
end

댓글 수: 4
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!