MATLAB Answers

0

Faded color under area of curve

Asked by Brett Kemman on 13 Sep 2019
Latest activity Answered by Raunak Gupta on 16 Sep 2019
Is there a way to fade the color under the area of a curve? For example, in an increasing plot that starts at 1 the area beneath the curve is white and as the curve increases to 100 it becomes a dark blue.
I'm aware of the area(x,y) function, but that just gives me a solid color.

  1 Comment

I think this solution by Patrick Kalita should apply to your question as well:
Depending on you application you might want to increase the number of colors on the colormap, e.g. adding
colormap(parula(256))
at the end.

Sign in to comment.

1 Answer

Answer by Raunak Gupta on 16 Sep 2019

Hi,
There is a similar answer which may be of revelance to you : https://www.mathworks.com/matlabcentral/answers/1387-area-plot-with-gradient.
For Linearly increasing the color as you mentioned from 1 to 100, You can use M(x) = x.
Hope this helps.

  0 Comments

Sign in to comment.