1

I am trying to generate a LaTeX pgfplot:

\begin{tikzpicture}
\begin{axis}[
xmin=.2,xmax=.5,
ymin=-.00000000000000001,ymax=.00000000000000001,
xlabel=Distance a (nm),
ylabel=Force F (mJ/nm)
]
\addplot[color=black][domain=.2:.5]{(((6.42*10^(-22))*6)/(x^7))-(((1.02*10^(-25))*13)/(x^14))};
\addplot[color=red][domain=.2:.5]{(((6.42*10^(-22))*6)/(x^7))};
\addplot[color=blue][domain=.2:.5]{-(((1.02*10^(-25))*13)/(x^14))};

\end{axis}
\end{tikzpicture}

This generates the error "dimension too large." What could be wrong?

dylhunn
  • 989
  • 2
  • 8
  • 25

1 Answers1

1

The problem is your ymin/max values. It gets much clearer when you use this the exponential form.

Here a working expample of your code:

\begin{tikzpicture}
\begin{axis}[
xmin=0.2, xmax=0.5,
ymin=-1e-16, ymax= 1e-16,% ymin=-.00000000000000001,ymax=.00000000000000001,
xlabel=Distance a (nm),
ylabel=Force F (mJ/nm)
]
\addplot[color=black][domain=.2:.5]{(((6.42*10^(-22))*6)/(x^7))-(((1.02*10^(-25))*13)/(x^14))};
\addplot[color=red][domain=.2:.5]{(((6.42*10^(-22))*6)/(x^7))};
\addplot[color=blue][domain=.2:.5]{-(((1.02*10^(-25))*13)/(x^14))};

\end{axis}
\end{tikzpicture}
Fledias weh
  • 321
  • 3
  • 4