# 实验数据散点图
using PlotlyJS
EA_293K = scatter(df, x = :C_EA, y = :q_EA_293K, mode="markers", name = "293K")
EA_303K = scatter(df, x = :C_EA, y = :q_EA_303K, mode="markers", name = "303K")
EA_313K = scatter(df, x = :C_EA, y = :q_EA_313K, mode="markers", name = "313K")
q_EA = plot(
[EA_293K, EA_303K, EA_313K],
Layout(
title = attr(text = "q_EA ~ C_EA", x = 0.5),
xaxis = attr(title = "C_EA (mg/mL)", dtick = "2"),
yaxis = attr(title = "q_EA (mg/mL)", dtick = "2")
)
)
# 回归拟合
function Langmuir(C, p) # Langmuir 模型
H, b = p
q = @. H * C / (1 + b*C )
end
param = []
p0 = [0.1, 0.1]
for col in names(df)[3:2:end]
xdata = df.C_EA
ydata = df[:, col]
ret = curve_fit(Langmuir, xdata, ydata, p0)
push!(param, ret.param)
end
param
# 模型曲线visualisation
xdata = collect(3:0.1:13)
for i in 1:length(param)
addtraces!(q_EA, scatter(x = xdata, y = Langmuir(xdata, param[i]), showlegend = false))
end
q_EA
The color of marker and line mismatch, what should I do?