# multiple non linear curve fitting using pgfplot for IC50 [closed]

My question is related with Non-linear curve fitting with gnuplot .I want to make multi IC50 using that plot which give result red, green and blue line, but only blue line appeared.

this is MWE

\documentclass[11pt]{article}
\usepackage{pgfplots}
\usepackage{siunitx}
\DeclareSIUnit\Molar{\textsc{m}} % http://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}


and the result is only blue line appear

This is the errors in .log actually during compile I can see three lines but after compile finish, two lines dissappear. I always use -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

-

## closed as too localized by Jake, egreg, percusse, Qrrbrbirlbel, Claudio FiandrinoOct 29 '12 at 17:47

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

I get all three lines. Are there any warnings or error messages in the .log file? –  Jake Oct 29 '12 at 16:00
Can you remove all .table and .gnuplot` files and check whether you still get the blue line? –  Jake Oct 29 '12 at 16:16
yes, i did.three lines appear during compile, but at last only blue line remain –  limpato Oct 29 '12 at 16:39
@Jake I have found the problem. I compile with pdflatex 3 times , only in the beginning has -shell-escape . 2 others no, then I change user command with all pdflatex contain -shell-escape and everything is allright. Please close this question. –  limpato Oct 29 '12 at 16:56