Plot a function with an specific colour asociated to each data
2 次查看(过去 30 天)
显示 更早的评论
I want to plot irradiaction data vs the exposure time, but I also want to assign an specific colour (described with RGB or CIELab parameters) to each value of irradiance.
Is there any way to plot irradiance vs time and create a fit associated with the color creating a custom colorbar? or at least, a plot with changing colour (ΔE* ) vs the irradiance but with the associated colorbar?
In order to calculate ΔE*, my reference colour value is the fist one, with is zero exposure.
ΔE* = ( ( L*1-L*2)2 + (a*1-a*2)2+(b*1-b*2)2 )1/2
Below I show the code with the graphs that I want to obtain, where it would be necessary to add the line colour.
clear all
clc
%Data
A=[88.83 -7.90 49.88 0 0
81.19 5.46 34.44 10.4 5
78.86 8.68 33.31 14.7 10
75.71 13.76 24.59 25.5 20
72.87 18.72 20.56 35.1 32
71.00 21.25 17.31 50.1 50];
L=A(:,1); %L*
a=A(:,2); %a*
b=A(:,3); %a*
I=A(:,4); %irradiance in mJ/cm2
t=A(:,5); %time in s
%Figure 1
figure (1)
plot(t,I)
xlabel('t (s)')
ylabel('I (mJ/cm^2)')
%Colour difference
for i=1:6
DL_star=A(i,1)-A(1,1);
Da_star=A(i,2)-A(1,2);
Db_star=A(i,3)-A(1,3);
DE_star(i)=sqrt((DL_star)^2+(Da_star)^2+(Db_star)^2);
end
%Graph of colour difference vs irradiance
figure(2)
plot(I,DE_star)
xlabel('I (mJ/cm^2)')
ylabel('\DeltaE')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
