scatter plot data that meet a condition
이전 댓글 표시
Hello, I have a matrix A(8,2000) and another one flag(8, 2000) which is logical.I would like to scatter plot data as follows: if an element of flag is 1 then i would like to represent the same element of table A as a red dote, while if is 0 as blue dot. The array x_axis has the values of x axis. Both axes i would like to be in logarithmic scale.
I tried this but i have the error
'Index exceeds matrix dimensions.'
Any idea about what i am doing wrong with dimensions?
x_axis=[1/6,1/3,1/2,1,2,3,6,12];
sz=8;
flag=(~flag==0);
for j=1:length(A)
scatter(x_axis,A(flag,j),sz,'r','filled');
set(gca, 'XScale', 'log','YScale','log')
hold on
scatter(x_axis,A(~flag,j),sz,'b','filled');
set(gca, 'XScale', 'log','YScale','log')
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

