Change color of section graph

5 visualizaciones (últimos 30 días)
Dionisio Mendoza
Dionisio Mendoza el 11 de Feb. de 2019
Comentada: madhan ravi el 15 de Feb. de 2019
Stephen23 ha marcado con alerta este/a pregunta
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.
group = (x <= 0) * 2 + (y <= 0) ;
pointsize = 30;
scatter(x, y, pointsize, group);
  1 comentario
madhan ravi
madhan ravi el 15 de Feb. de 2019
Editing question after someone has answered is highly discouraged in this forum.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Feb. de 2019
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];
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.

Más respuestas (0)


Más información sobre Colormaps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by