MATLAB Answers

How to shade area under 2D- curve into a certain x values

3 views (last 30 days)
Teresa Rotava
Teresa Rotava on 21 Feb 2020
Commented: darova on 21 Feb 2020
Hi everyone! I need some help to fill my graphic! I researched for many examples, but any of them is working.
I wanted to fill the area bellow the curve into the X-value of 35 with one colour and bellow this level with another colour. I tried the functions fill and area, none of them worked.
The data is also attached to the question!
Thank you in advance!
clear all
%% Set the Thresholds
highTOC = 35;
medTOC = 64;
Data = readtable('cl024_12._lab.txt');
L = Data.L;
Depth = Data.Depth;
%% correct the L* field measurements according to the calibration
Lmin_o = 0;%old minimum
Lmax_o = 100;%old maximum
Lmin_n = 26.6;%new minimum
Lmax_n = 99.6;%new maximum
NEWL = ((Lmax_n - Lmin_n)/(Lmax_o - Lmin_o)*L)+Lmin_n;
L_real = smooth(NEWL,15);
baseval = 35;
hold on
hold off
axis ij


Show 1 older comment

Sign in to comment.

Accepted Answer

darova on 21 Feb 2020
Maybe something is wrong with importing? Try importdata
Data = importdata('cl024_12._lab.txt');
L =,5);
Depth =,1);


darova on 21 Feb 2020
Try fill() / patch()
Teresa Rotava
Teresa Rotava on 21 Feb 2020
It was really just the importing :-/ Thank you so much for your patience!

Sign in to comment.

More Answers (0)

Sign in to answer this question.