I am trying to colorize a tape of complex functions. However, this is not very good (see Figure below):

I want to draw only the bottom of the function. However, in this case, only the part associated with the vertices is colored, and the painted part contains a curve.
My code is:
p1 = ggplot(data.frame(x=c(-2.14344,1.25), y=c(0,12.5)),
aes(x, y))
p1 = p1 + stat_function(fun = function(x)(exp( -18.82 + 16.99 * x) + exp(-0.5497 - 0.6572 * x)))
p1 = p1 + xlim(-2.14344,1.25) + ylim(0,12.5)
p1 = p1 + geom_ribbon(fill="blue", alpha = 0.5,
aes(ymax = exp( -18.82 + 16.99 * x) + exp(-0.5497 - 0.6572 * x),
ymin = 0))
print(p1)
I tried to solve this problem and searched for solutions on Google. But I could not find any suggestions.
If you know a suggestion, please tell me how to solve it. Thank!
source
share