Info

此问题已关闭。 请重新打开它进行编辑或回答。

Group the values of a graph in four

1 次查看(过去 30 天)
Dionisio Mendoza
Dionisio Mendoza 2019-2-10
关闭: MATLAB Answer Bot 2021-8-20
I need to group in 4 the values of these two vectors of 1500 numbers ranging from -100 to 100, so that the following graph divided into 4 sections appears. I do not know whether to use axes or what procedure to execute
x=-100+(100+100)*rand(1500,1);
y=-100+(100+100)*rand(1500,1);
plot(x,y,'or')
  3 个评论

回答(1 个)

Walter Roberson
Walter Roberson 2019-2-11
group = (x <= 0) * 2 + (y <= 0) + 1;
pointsize = 15;
scatter(x, y, pointsize, group);
colormap(jet(4))
  4 个评论
Walter Roberson
Walter Roberson 2019-2-11
You can create a 4 x 3 matrix of color values and colormap() that matrix.

此问题已关闭。

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by