scatter plot data that meet a condition
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
