Hi Carolyn, All you need do is change the colormap line to colormap(sort(Color, 'descend')); but make sure that you have cleared your variables first. With your previous command, Matlab creates a variable named 'colormap' and you do not want that. The forgoing method works, but you get a pretty ugly colorbar with four sections of constant color. For a nicer colorbar you can make a more continuous version of the colormap, such as x=[1,2,3,4]; y=[5,6,7,8]; sz = 100; N = 64; % or whatever Color1 = [ones(N,1),(N-1:-1:0)'/(N-1),zeros(N,1)]; colormap(Color1) s=scatter(x,y,sz,y,'filled'); colorbar This also gives you the opportunity to put not a matrix of rgb values into the scatter 'C' input as you did, but but rather to make C a vector of the same length as x and y. Then the collection of C vector values is mapped into the entire colormap from bottom to top. As you see, the y values were mapped to colors in the code above. That idea may not apply directly in your case with the circular plot, but you can make a C vector with appropriate values that map into the colormap. Answer from David Goodmanson on mathworks.com
๐ŸŒ
MathWorks
mathworks.com โ€บ matlab โ€บ graphics โ€บ labels and styling โ€บ color and styling
colormap - View and set current colormap - MATLAB
colorbar | colormaplist | ind2rgb | hsv2rgb | rgbplot ... Run the command by entering it in the MATLAB Command Window.
๐ŸŒ
MathWorks
mathworks.com โ€บ matlab โ€บ graphics โ€บ labels and styling โ€บ color and styling
Change Color Scheme Using a Colormap - MATLAB & Simulink
Each predefined colormap provides a palette of 256 colors by default. However, you can specify any number of colors by passing a whole number to the predefined colormap function.
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 2081963-creating-a-colorbar-in-matlab
Creating a colorbar in Matlab - MATLAB Answers - MATLAB Central
February 14, 2024 - https://www.mathworks.com/matlabcentral/answers/2081963-creating-a-colorbar-in-matlab#comment_3064818 ... The colorbar just displays the bar which shows the color scale of the figure.
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 233154-create-colorbar-for-custom-colormap-used-in-scatter
Create colorbar for custom colormap used in Scatter? - MATLAB Answers - MATLAB Central
August 10, 2015 - You would create a set of invisible objects with the correct colors, and then insert them into the legend with their DisplayName properties set to the values. ... https://www.mathworks.com/matlabcentral/answers/233154-create-colorbar-for-custom-colormap-used-in-scatter#comment_303705
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 352402-colorbar-is-not-representing-my-current-colormap-correctly
Colorbar is not representing my current colormap correctly - MATLAB Answers - MATLAB Central
August 11, 2017 - The values that colors get assigned to are negative and positive. In my sample, I clearly get some bright red spots that are not represented by the colorbar. ... Sign in to comment. Sign in to answer this question. ... https://www.mathworks.com/matlabcentral/answers/352402-colorbar-is-not-representing-my-current-colormap-correctly#answer_277667
Find elsewhere
๐ŸŒ
MathWorks
mathworks.com โ€บ matlab โ€บ graphics โ€บ graphics objects โ€บ graphics object properties
ColorBar - Colorbar appearance and behavior - MATLAB
Label that displays along the colorbar, returned as a text object. This text object contains properties that control the label appearance and the text that displays. Use the Label property to access the text object, for example: ... ans = Text with properties: String: '' FontSize: 10 FontWeight: 'normal' FontName: 'Helvetica' Color: [0.1500 0.1500 0.1500] HorizontalAlignment: 'left' Position: [0 0 0] Units: 'data' Show all properties
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 19456254 โ€บ customize-colors-in-color-bar-matlab
colorbar - customize colors in color bar MATLAB - Stack Overflow
The comments to your question by Cici and thewaywewalk are on the right track. To elaborate: colorbar, by default, will display a color bar of the current color map, which you can set with the command colormap.
๐ŸŒ
Dummies
dummies.com โ€บ article โ€บ technology โ€บ programming-web-design โ€บ matlab โ€บ how-to-use-a-color-bar-with-your-matlab-plot-203419
How to Use a Color Bar with Your MATLAB Plot | dummies
June 30, 2025 - Using a color bar with your MATLAB plot can help people see data values based on color rather than pure numeric value. The color bar itself can assign human-understandable values to the numeric data so that the data means something to those viewing it. The best way to work with color bars is to see them in action. The following steps help you create a color bar by using the colorbar() function and use it to define values in a bar chart:
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 787-how-do-i-control-the-min-and-max-values-for-colorbar-within-an-m-file
How do I control the min and max values for colorbar within an m-file. - MATLAB Answers - MATLAB Central
February 3, 2011 - I am currently using the colorbar to display the energy level but can't figure out how to set the min and max levels within the m-file. I know you can do this within the plot of each frame, but this obviously won't work for me. I'm using the plot command "scatter3". Any suggestions would be greatly appreciated. ... Sign in to comment. Sign in to answer this question. ... https://www.mathworks.com/matlabcentral/answers/787-how-do-i-control-the-min-and-max-values-for-colorbar-within-an-m-file#answer_1141
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 2050967-changing-the-color-of-a-second-colorbar
Changing the color of a second colorbar - MATLAB Answers - MATLAB Central
November 22, 2023 - The makes the range on the colorbars be the same 1-160, the two are not independent of each other. When I use the cb2.Limit functions it allows the west color bar to be from 1-160 and the east bar to be from 1-30 however the east bar only shows blue values and not the full range as shown in the attached image. ... https://www.mathworks.com/matlabcentral/answers/2050967-changing-the-color-of-a-second-colorbar#comment_2976862
๐ŸŒ
MathWorks
es.mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 371638-how-to-customize-a-color-bar-in-matlab-plot
How to customize a color bar in matlab plot? - MATLAB Answers - MATLAB Central
Thanks for prompt reply. I tried your method but the transition from white to other colors is not smooth enough. Anyway, i have found an answer to my question here (https://www.mathworks.com/matlabcentral/fileexchange/36212-b2r-cmin-input-cmax-input-) Thanks again :)
๐ŸŒ
MathWorks
mathworks.com โ€บ matlabcentral โ€บ answers โ€บ 876043-2d-scatter-plot-with-colorbar
2D scatter-plot with colorbar - MATLAB Answers - MATLAB Central
July 10, 2021 - I tried to use scatter function, but I found I have to input Z (which represent here the no of measurements in bin) to the function to plot colored scatter plot, and I don't know how to get the count of the measurements in each color as input. ... Sign in to comment. Sign in to answer this question. ... You can represent the no of measurements in bin as the fourth argument while calling the scatter plot. Here is the sample plot using random data. ... https://www.mathworks.com/matlabcentral/answers/876043-2d-scatter-plot-with-colorbar#comment_2562700