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

1 回表示 (過去 30 日間)
Teresa Rotava
Teresa Rotava 2020 年 2 月 21 日
コメント済み: darova 2020 年 2 月 21 日
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!
clc
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);
%%
figure(1)
plot(L_real,Depth)
baseval = 35;
hold on
area(min(L_real,baseval),Depth,baseval)
xlabel('L*','FontSize',12,'FontWeight','bold')
hold off
axis ij
  4 件のコメント
darova
darova 2020 年 2 月 21 日
Don't understand
Teresa Rotava
Teresa Rotava 2020 年 2 月 21 日
When I run my code, I got this image.

サインインしてコメントする。

採用された回答

darova
darova 2020 年 2 月 21 日
Maybe something is wrong with importing? Try importdata
Data = importdata('cl024_12._lab.txt');
L = Data.data(:,5);
Depth = Data.data(:,1);
  3 件のコメント
Teresa Rotava
Teresa Rotava 2020 年 2 月 21 日
It was really just the importing :-/ Thank you so much for your patience!
darova
darova 2020 年 2 月 21 日
You are welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNaNs についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by