Skip to content

Instantly share code, notes, and snippets.

@NickWoodhams
Created January 23, 2017 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickWoodhams/8ecf32ff58f94a849b279ce51218de96 to your computer and use it in GitHub Desktop.
Save NickWoodhams/8ecf32ff58f94a849b279ce51218de96 to your computer and use it in GitHub Desktop.
Generate scatterplot with 2 different colors
data =xlsread('data.xlsx');
vec1 = data (:,1);
vec2 = data (:,2);
mean_vec1 = mean(vec1)
hold on
find(vec1);
find(vec2);
hold on;
for i=1:length(vec1)
if vec1(i) > mean_vec1
scatter(vec1(i), vec2(i), 'blue', 'filled')
else
scatter(vec1(i), vec2(i), 'red', 'filled')
end
end
xlabel('Vec1')
ylabel('Vec2')
hold off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment