- Map your time variable to a colormap: First, you need to map the values of your time variable (Final_max) to a colormap. MATLAB provides various colormaps (e.g., 'jet', 'hsv', 'hot', etc.), and you can choose one that suits your data visualization needs. Here is a list of available colormaps for MATLAB: https://www.mathworks.com/help/matlab/ref/colormap.html#buc3wsn-6:~:text=%7C%20%27default%27-,Colormap,-for%20the%20new
- Create a scatter plot and manually set the colors: Instead of using "gscatter", use the "scatter" function and manually set the colors of each point based on the mapped colormap values.
- Add a colorbar: Add a colorbar to your plot to represent the range of your time variable.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1635111/image.png)