使用 pgfplot 对 IC50 进行多重非线性曲线拟合

使用 pgfplot 对 IC50 进行多重非线性曲线拟合

我的问题与使用 gnuplot 进行非线性曲线拟合我想使用该图制作多 IC50,该图给出红、绿和蓝线的结果,但只出现蓝线。

这是MWE

\documentclass[11pt]{article}
\usepackage{pgfplots}
\usepackage{siunitx}
\DeclareSIUnit\Molar{\textsc{m}} % https://tex.stackexchange.com/a/27618/828
\begin{filecontents}{test11.dat}
2   12
5   55
10  96
20  135
50  144
100 147
200 147
500 146
\end{filecontents}
\begin{filecontents}{drc11.dat}
2   17
5   60
10  92
20  127
50  144
100 147
200 157
500 166
\end{filecontents}
\begin{filecontents}{drc13.dat}
1   11
3   40
12  82
21  97
40  104
80 117
100 127
400 136
\end{filecontents}
\begin{document}

\begin{figure}[h!t]
\centering
\begin{tikzpicture}
% test11 red line
\begin{axis}[
    xmode=log,
    ymode=linear,
    axis x line*=bottom,
    axis y line*=left,
tick label style={font=\small},
grid=both,
tick align=outside, 
    tickpos=left,
xlabel= {[ACh]} (nM),
ylabel=Response (mm),
    xmin=0.1, xmax=1000,
    ymin=0, ymax=160,
    width=0.8\textwidth,
    height=0.6\textwidth,
]

\addplot[only marks] file {test11.dat};
% Now call gnuplot to fit this data
% The key is the raw gnuplot option
% which allows to write a gnuplot script file
\addplot+[raw gnuplot, draw=red, mark=none, smooth] gnuplot {
set log x; % <------------------------------------------------- this is the magic line
f(x)=Ymax/(1+(EC50/x)^nH);
% let gnuplot fit, using column 1 and 2 of the data file
% using the following initial guesses
Ymax=150;
nH=2;
EC50=60;
     fit f(x) 'test11.dat' using 1:2 via Ymax,EC50,nH;
     % Next, plot the function and specify plot range
     % The range should be approx. the same as the test.dat x range
     plot [x=0.1:1000] f(x);
   };       
\end{axis}
% % % %
\begin{axis}[
    xmode=log,
    ymode=linear,
    axis x line*=bottom,
    axis y line*=left,
tick label style={font=\small},
grid=both,
tick align=outside, 
    tickpos=left,
xlabel= {[ACh]} (nM),
ylabel=Response (mm),
    xmin=0.1, xmax=1000,
    ymin=0, ymax=160,
    width=0.8\textwidth,
    height=0.6\textwidth,
]
\addplot[only marks] file {drc11.dat};
% Now call gnuplot to fit this data
% The key is the raw gnuplot option
% which allows to write a gnuplot script file
\addplot+[raw gnuplot, draw=green, mark=none, smooth] gnuplot {
set log x; % <------------------------------------------------- this is the magic line
f(x)=Ymax/(1+(EC50/x)^nH);
% let gnuplot fit, using column 1 and 2 of the data file
% using the following initial guesses
Ymax=150;
nH=2;
EC50=60;
     fit f(x) 'drc11.dat' using 1:2 via Ymax,EC50,nH;
     % Next, plot the function and specify plot range
     % The range should be approx. the same as the test.dat x range
     plot [x=0.1:1000] f(x);
   };       
\end{axis}
%DRC13 : blue line
\begin{axis}[
    xmode=log,
    ymode=linear,
    axis x line*=bottom,
    axis y line*=left,
tick label style={font=\small},
grid=both,
tick align=outside, 
    tickpos=left,
xlabel= {[ACh]} (nM),
ylabel=Response (mm),
    xmin=0.1, xmax=1000,
    ymin=0, ymax=160,
    width=0.8\textwidth,
    height=0.6\textwidth,
]

\addplot[only marks] file {drc13.dat};
% Now call gnuplot to fit this data
% The key is the raw gnuplot option
% which allows to write a gnuplot script file
\addplot+[raw gnuplot, draw=blue, mark=none, smooth] gnuplot {
set log x; % <------------------------------------------------- this is the magic line
f(x)=Ymax/(1+(EC50/x)^nH);
% let gnuplot fit, using column 1 and 2 of the data file
% using the following initial guesses
Ymax=150;
nH=2;
EC50=60;
     fit f(x) 'drc13.dat' using 1:2 via Ymax,EC50,nH;
     % Next, plot the function and specify plot range
     % The range should be approx. the same as the test.dat x range
     plot [x=0.1:1000] f(x);
   };       
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}

结果是只出现蓝线 在此处输入图片描述

这是 .log 中的错误,实际上在编译期间我可以看到三行,但编译完成后,两行消失了。我总是使用“-shell-escape”

! Undefined control sequence.
<write> gnuplot -V >\pgfplots@plot@filename 
                                            .vrs
l.36 ...gnuplot@logbehavior@checkversion\endcsname

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

runsystem(gnuplot -V >.vrs)...disabled (restricted).

! Undefined control sequence.
\pgfplots@identify@gnuplot@logbehavior@checkversion ...
                                                  .vrs\relax \ifeof \r@pgfpl...
l.36 ...gnuplot@logbehavior@checkversion\endcsname

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

Package pgfplots: checking gnuplot -V : `gnuplot 4.6 patchlevel 0 ' (if this fa
ils, set `/pgfplots/gnuplot writes logscale=true|false')
Package pgfplots: I found gnuplot version >= 4.4. This one doesn't write log() 
coordinates. I will apply log() manually.
PGFPlots: reading {test11.dat}
runsystem(gnuplot IC50curvesederhana.pgf-plot.gnuplot)...disabled (restricted).

PGFPlots: reading {IC50curvesederhana.pgf-plot.table}
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <7> on input line 75.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <5> on input line 75.
PGFPlots: reading {drc11.dat}
runsystem(gnuplot IC50curvesederhana.pgf-plot.gnuplot)...disabled (restricted).

PGFPlots: reading {IC50curvesederhana.pgf-plot.table}
PGFPlots: reading {drc13.dat}
runsystem(gnuplot IC50curvesederhana.pgf-plot.gnuplot)...disabled (restricted).

PGFPlots: reading {IC50curvesederhana.pgf-plot.table}
[1

相关内容