How do I display certain data on top of others using multiple Scatter plots
조회 수: 32 (최근 30일)
이전 댓글 표시
scatter(real(SGG(ids)),imag(SGG(ids)),10,[0 1 0],'filled');
hold on
for abc=1:M
scatter(1*cos((2*abc-1)*pi/M),1*sin((2*abc-1)*pi/M),35,[0 0 1],'filled');
end
scatter(real(SRR(idx)),imag(SRR(idx)),10,[1 0 0],'filled');
xlabel('Real Part');
ylabel('Imaginary Part');
title('ACE For MaxMin');
legend([scatter(real(SGG(ids)),imag(SGG(ids)),10,[0 1 0],'filled'), ...
scatter(1*cos((2*abc-1)*pi/M),1*sin((2*abc-1)*pi/M),15,[0 0 1],'filled'),...
scatter(real(SRR(idx)),imag(SRR(idx)),10,[1 0 0],'filled')],'Correct-Decoded Signal','QPSK Signal','Error-Decoded Signal');
xlabel('Real Part');
ylabel('Imaginary Part');
title('ACE For MaxMin');
hold off
The above are the codes that I used to create multiply scatter plots, but everytime the second scatterplot's data gets overlapped by the other scatterplots.
for abc=1:M
scatter(1*cos((2*abc-1)*pi/M),1*sin((2*abc-1)*pi/M),35,[0 0 1],'filled');
end
This is the scatter plot data that I want to display at the very top without other data overlapping it, is there a way to do that?
채택된 답변
Dave B
2021년 8월 2일
You can manipulate the stacking order in the axes by changing the order of the axes children vector or using the ustack function:
ax=gca;
h1=scatter(ax,rand(1000,1),rand(1000,1),100,'filled','r');
hold on
h2=scatter(ax,rand(1000,1),rand(1000,1),100,'filled','b');
ax.Children=[h1;h2]; % display the red one on top of the blue one
uistack(h1); % display the red one on top
Note: your call to legend is suspicious, it looks like you're making additional scatters (?) If you capture the output of the scatters in a variable, you can pass that variable to legend rather than calling scatter again.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Scatter Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!