Change color of section graph

5 ビュー (過去 30 日間)
Dionisio Mendoza
Dionisio Mendoza 2019 年 2 月 11 日
コメント済み: madhan ravi 2019 年 2 月 15 日
この 質問 は Stephen23 さんによってフラグが設定されました
I need to change the color of each quadrant of the graph, in the code I know I have a map color, but I was wondering if it is possible to manually change each color.
x=-100+(100+100)*rand(1500,1);
y=-100+(100+100)*rand(1500,1);
group = (x <= 0) * 2 + (y <= 0) ;
pointsize = 30;
scatter(x, y, pointsize, group);
colormap(jet(4))
  1 件のコメント
madhan ravi
madhan ravi 2019 年 2 月 15 日
Editing question after someone has answered is highly discouraged in this forum.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2019 年 2 月 11 日
Instead of colormap(jet(4)) create the colormap you want as a 4 x 3 array and colormap() it.
cmap = [1 0 0;
0 1 0;
0 0 1;
0 0 0];
colormap(cmap);
Note: your group variable will be 0, 1, 2, or 3 and so will not map directly to a colormap entry. The code I had suggested to you added 1 to group, getting 1, 2, 3, or 4.
  1 件のコメント
Dionisio Mendoza
Dionisio Mendoza 2019 年 2 月 11 日
Thank's a lot.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by