Recently, I needed to plot a bunch of time series with gradient colour on the y-axis direction. I wanted the colour to change based on the value of y for each cluster of x. For instance, if you have 10000 days of hourly data, where you want to plot these days in a figure with respect to their magnitude in each time instance. It is sort of similar to confidence interval plot with surface painting, but not exactly the same. I also wanted to be able to have a scatter plot of the time series with the same specifications. After googling, I came across no function or package to be able to do this in MATLAB. MATLAB has `predint`

function, which calculates the confidence interval to be used with surface plot. But, it is essentially different from what I was looking for. There is another package for confidence interval plots, which seems more capable compared to `predint`

. Again, it could not do what I wanted. Let me show you what I was looking for in the two figures below:

The need for such a plot pushed me to develop `gradientplot`

function for MATLAB. This package allows users to plot time series with gradient colour of interest on the y-axis direction. The function is very intuitive to use, and the final plot can be modified with common MATLAB commands, e.g., `xlabel`

, `title`

, `subplot`

, etc. Users can create scatter or line plot based on their requirements. Also, it is possible to define a global or local maximum/minimum for colour intensity calculations. I have created a nice and comprehensive help file to get the users through learning the package. Hope this function can help others in the community.

You can download the package from my website. Also, you can see and modify the package on GitLab public project. It is also available on MATLAB Central File Exchange website.