TikZ Function Number Too Big
Not a direct answer but I would use pgfplots
for this. Maybe turning on the fpu
library at the right point, might solve the problem but you don't need to draw any axis etc. so I think this is much more convenient.
\documentclass{standalone}
\usepackage{pgfplots}
\usetikzlibrary{arrows}
\definecolor{qqccqq}{rgb}{0,0.8,0}
\definecolor{qqttcc}{rgb}{0,0.2,0.8}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round]
\begin{axis}[
axis lines=middle,
every inner x axis line/.append style={-triangle 45},
every inner y axis line/.append style={-triangle 45},
enlargelimits]
\addplot[dash pattern=on 1pt off 1pt,color=qqttcc, smooth,samples=100,domain=8.000000000003847E-7:0.9999990727280006] plot(\x,{3682570000*(1-(\x))^(10.67)*(\x)^(21.49)});
\addplot[color=qqccqq, smooth,samples=100,domain=8.000000000003847E-7:0.9999990727280006] plot(\x,{2120.93*(1-(\x))^(2.67)*(\x)^(9.49)});
\node at (axis cs:0.49,4.17) {$g(\theta|D)$};
\node at (axis cs:0.89,3.23) {$g(\theta)$};
\end{axis}
\end{tikzpicture}
\end{document}
The problem related to your edit is that the numbers become too small towards the end of the domain. To show that I've switched to the logarithm axis on y axis. TeX cannot handle that precision but the fpu
library of TikZ or pgfplots
by default can handle up to some extent and exits with divide by zero error. Otherwise pgfplots
allows for gnuplot
directives to be executed outside of TeX. Please check the manual of pgfplots
Also you don't need to define everycolor you use. xcolor is a pretty powerful package so you can use color mixing capabilities. Here is a minimal example without any axis settings etc. to show how easy to use:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8} % The latest version on CTAN
\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}
\addplot[red,smooth,samples=100,domain=0.0:1.0] {(3.1415926535*sin(((x)*3.1415926535)*180/pi))/2};
\addplot[green!80!black, smooth,samples=100,domain=0.0:1.0] {(x)^1^2*(1-(x))^8*sin(((x)*3.1415926535)*180/pi)*1/(3.44*10^(-7))};
\addplot[blue!80!green, ultra thick,smooth,samples=100,domain=0.0:1.0] {2.718281828^((-((x)-0.58)^2)/(0.1^2*2))/(abs(0.1)*sqrt(3.1415926535*2))};
\end{semilogyaxis}
\end{tikzpicture}
\end{document}
Consider also an Asymptote option, as it's quite powerful in graph drawing,
especially when there is an array of curves. An example below
organizes functions in array; other properties like color, width, label etc
can be organized in arrays as well to be drawn in one loop.
Also, the y
-coordinate of the label is calculated as a point on the curve.
asy-plot.tex
\documentclass{standalone}
\usepackage{lmodern}
\usepackage[inline]{asymptote}
\begin{document}
\begin{asy}
import graph;
size(250,170,IgnoreAspect);
real xMin=8.000000000003847e-7;
real xMax=0.9999990727280006;
int n=100;
typedef real Func(real x);
Func[] f={
new real(real x){return 3682570000*(1-x)^(10.67)*x^(21.49);},
new real(real x){return 2120.93*(1-x)^2.67*x^9.49;},
};
pen dashed=linetype(new real[] {4,3}); // set up dashed pattern
pen[] curvePen={rgb(0,0.8,0)+dashed,rgb(0,0.2,0.8),};
real[] curveWidth={1.6pt,2pt};
Label[] lab={
Label("$g(\theta\,\vert D)$",(0.6,f[0](0.6))),
Label("$g(\theta)$",(0.9,f[1](0.9))),
};
for(int i=0;i<f.length;++i){
draw(graph(f[i], xMin ,xMax ,n),curvePen[i]+curveWidth[i]);
label(lab[i],UnFill(2pt));
}
xaxis("",0,1.049,RightTicks(Step=0.1,step=0.05),EndArrow);
yaxis("",0,5-0.15,LeftTicks(Step=1,step=0.5),EndArrow);
\end{asy}
\end{document}
To process it with latexmk
, create file latexmkrc
:
sub asy {return system("asy '$_[0]'");}
add_cus_dep("asy","eps",0,"asy");
add_cus_dep("asy","pdf",0,"asy");
add_cus_dep("asy","tex",0,"asy");
and run latexmk -pdf asy-plot.tex
. The result looks like