Assignment of colors in a scatter plot
I have a problem when using the colorbar in my scatter plot. I have a variable called flag, that can have the value 0, 1 or 2 and is used to plot the color of my scatter plot. Furthermore I defined a custom colormap with three colors which are assigned to each flag. The problem that arrises now is that the wrong colors are used in my scatter plot.
For example: Flag 1 is coded with green but the scatter shows it in blue (used for flag 0). I tried to solve it by setting the limits manually but it still has a problem with correctly assigning the colors.
c = colorbar;
c.Ticks = [0, 1, 2];
clim([0 2]);
Heres an example shown:
The first tile shows both data together and the two tiles at the bottom seperately. The colors in the third tile (bottom right) are shown correctly but in the first tile they are shown in a different color.I have a problem when using the colorbar in my scatter plot. I have a variable called flag, that can have the value 0, 1 or 2 and is used to plot the color of my scatter plot. Furthermore I defined a custom colormap with three colors which are assigned to each flag. The problem that arrises now is that the wrong colors are used in my scatter plot.
For example: Flag 1 is coded with green but the scatter shows it in blue (used for flag 0). I tried to solve it by setting the limits manually but it still has a problem with correctly assigning the colors.
c = colorbar;
c.Ticks = [0, 1, 2];
clim([0 2]);
Heres an example shown:
The first tile shows both data together and the two tiles at the bottom seperately. The colors in the third tile (bottom right) are shown correctly but in the first tile they are shown in a different color. I have a problem when using the colorbar in my scatter plot. I have a variable called flag, that can have the value 0, 1 or 2 and is used to plot the color of my scatter plot. Furthermore I defined a custom colormap with three colors which are assigned to each flag. The problem that arrises now is that the wrong colors are used in my scatter plot.
For example: Flag 1 is coded with green but the scatter shows it in blue (used for flag 0). I tried to solve it by setting the limits manually but it still has a problem with correctly assigning the colors.
c = colorbar;
c.Ticks = [0, 1, 2];
clim([0 2]);
Heres an example shown:
The first tile shows both data together and the two tiles at the bottom seperately. The colors in the third tile (bottom right) are shown correctly but in the first tile they are shown in a different color. scatter plot, colorbar, assignment MATLAB Answers — New Questions