Adding specific colors on a fig file
1 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
Is it possible to add, directly in Matlab, some colors on specific zones of a fig file ?
For instance, if I want the area below a curve to be in a specific color and the area above with another one ?
Thank you for your help,
Sincerely.
0 个评论
采纳的回答
Mann Baidi
2024-4-7
Hi,
As per the understanding of the question, you would like to add different background color for area above and area below the plotted line.
This can be done using the 'area' function in MATLAB. Here is an example for the same.
% Define constants
a = 0.1; % adjust this value to change the shape of the parabola
% Define range of y values
y = linspace(-10, 10, 100);
% Calculate corresponding x values
x = a * y.^2;
area(x)
You can explore more about the 'area' function by referring to the following link:
I hope this helps.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!