# Plotting with TikZ/pgf (GeoGebra export): Dealing with a very small coordinate intervals

I am not so familiar to plot with TikZ-pgf. However, I am going to plot the following figure with this:

Edit my ManuelKuehner

According to one of the comments of the Original Poster (OP) the code below is generated using the software GeoGebra

And the code I used is listed below:

 \documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{xdxdff}{rgb}{0.49019607843137253,0.49019607843137253,1.}
\definecolor{ffdxqq}{rgb}{1.,0.8431372549019608,0.}
\definecolor{ffzzqq}{rgb}{1.,0.6,0.}
\definecolor{wwccqq}{rgb}{0.4,0.8,0.}
\definecolor{qqzzqq}{rgb}{0.,0.6,0.}
\definecolor{qqzzff}{rgb}{0.,0.6,1.}
\definecolor{ffqqqq}{rgb}{1.,0.,0.}
\definecolor{qqqqff}{rgb}{0.,0.,1.}

\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=31249.999999999996cm,y=5.0cm]
\draw[->,color=black] (0.,0.) -- (1.6E-4,0.);
\foreach \x in {}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0.,0.) -- (0.,1.);
\foreach \y in {,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\clip(0.,0.) rectangle (1.6E-4,1.);
\draw[line width=1.2pt,color=qqzzff,smooth,samples=100,domain=0.0:1.6E-4] plot(\x,{0-1.209E12*(\x)^(3.0)+2.4E8*(\x)^(2.0)-5028.3*(\x)+0.0493});
\draw[line width=1.2pt,color=wwccqq,smooth,samples=100,domain=0.0:1.6E-4] plot(\x,{0-2.841E11*(\x)^(3.0)+2.185E7*(\x)^(2.0)+5514.2*(\x)+0.2326});
\draw[line width=1.2pt,color=ffdxqq,smooth,samples=100,domain=0.0:1.6E-4] plot(\x,{0-2.304E10*(\x)^(3.0)+2051000.0*(\x)^(2.0)+180.1*(\x)+0.4336});
\begin{scriptsize}
\draw [fill=qqqqff] (4.9999999999999996E-6,0.025) circle (2.5pt);
\draw [fill=qqqqff] (1.E-5,0.028) circle (2.5pt);
\draw [fill=qqqqff] (5.E-5,0.245) circle (2.5pt);
\draw [fill=qqqqff] (1.E-4,0.738) circle (2.5pt);
\draw [fill=qqqqff] (1.5E-4,0.614) circle (2.5pt);
\draw [color=ffqqqq] (1.1E-4,0.74)-- ++(-2.0pt,-2.0pt) -- ++(4.0pt,4.0pt) ++(-4.0pt,0) -- ++(4.0pt,-4.0pt);
\draw[color=ffqqqq] (1.267692141088968E-4,0.7827306483430722) node {$(0.00011, 0.74)$};
\draw[color=qqzzff] (4.9837731294315994E-5,0.10589055646933908) node {$y_1(x) = -1209000000000x³ + 240000000x² - 5028.3x + 0.0493$};
\draw [fill=qqzzqq] (5.E-6,0.271) circle (2.5pt);
\draw [fill=qqzzqq] (1.E-5,0.277) circle (2.5pt);
\draw [fill=qqzzqq] (5.E-5,0.531) circle (2.5pt);
\draw [fill=qqzzqq] (1.E-4,0.717) circle (2.5pt);
\draw [fill=qqzzqq] (1.5E-4,0.593) circle (2.5pt);
\draw [color=ffqqqq] (1.1E-4,0.7)-- ++(-2.0pt,-2.0pt) -- ++(4.0pt,4.0pt) ++(-4.0pt,0) -- ++(4.0pt,-4.0pt);
\draw[color=ffqqqq] (1.2676921410889684E-4,0.6663987575522743) node {$(0.00011, 0.7)$};
\draw[color=wwccqq] (4.776782592710754E-5,0.1746321283002651) node {$y_2(x) = -284100000000x³ + 21850000x² + 5514.2x + 0.2326$};
\draw [fill=ffzzqq] (5.E-6,0.435) circle (2.5pt);
\draw [fill=ffzzqq] (1.E-5,0.435) circle (2.5pt);
\draw [fill=ffzzqq] (5.E-5,0.445) circle (2.5pt);
\draw [fill=ffzzqq] (1.E-4,0.449) circle (2.5pt);
\draw [fill=ffzzqq] (1.5E-4,0.429) circle (2.5pt);
\draw[color=ffdxqq] (5.984227390249018E-5,0.3914324702285702) node {$y_3(x) = -23040000000x³ + 2051000x² + 180.1x + 0.4336$};
\end{scriptsize}
\end{tikzpicture}
\end{document}


Here is my problem: there appears an error message:

I can't work with sizes bigger than about 19 feet.

How can I fix the problem to get the correct plot?

Thanks a lot!

• Are you sure about this: x=31249.999999999996cm? This is over 300 m. Mar 9, 2016 at 16:08
• Just define the width of the diagram directly. Look in the manual for the expression width and you will find examples. Same for height. I am on my phone and cannot provide an example. And maybe it's easier to provide all data in an more appropriate range like 1 mm instead of 1*10-3 m. Mar 9, 2016 at 16:12
• I would recommend using PGFPlots (instead of raw TikZ) for this, since it handles the scaling properly.
– Jake
Mar 9, 2016 at 16:26
• In order to make the calculation, Tikz consider number as length. So a number can't be bigger than what Tikz can handle. The problem come from your formula. You have a coefficient of 1.209E12. Have you consider modifying your formula. Instead of $1.209E12\times (1.4E-4)^3$, you could use $1.209\times (1.4)^3$. The result will be the same, but Tikz can do the later. Mar 9, 2016 at 17:26
• I edited your question accordingly. Can't you edit your question yet? Mar 12, 2016 at 14:08

With so many comments, I tried to modified the code slightly. Basically, I tried to scale my equations of curves, the intervals of the coordinate, and the location of the points reasonably. The revised code is listed below.

\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{xdxdff}{rgb}{0.49019607843137253,0.49019607843137253,1.}
\definecolor{ffzztt}{rgb}{1.,0.6,0.2}
\definecolor{ffdxqq}{rgb}{1.,0.8431372549019608,0.}
\definecolor{ffzzqq}{rgb}{1.,0.6,0.}
\definecolor{wwccqq}{rgb}{0.4,0.8,0.}
\definecolor{qqzzqq}{rgb}{0.,0.6,0.}
\definecolor{qqzzff}{rgb}{0.,0.6,1.}
\definecolor{ffqqqq}{rgb}{1.,0.,0.}
\definecolor{qqqqff}{rgb}{0.,0.,1.}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.9cm,y=5.5cm]
\draw[->,color=black] (0.,0.) -- (8.5,0.);
\foreach \x in {,2.,4.,6.,8.}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt);
\node[below] at (2,0) {\footnotesize $4\times 10^{-5}$};
\node[below] at (4,0) {\footnotesize $8\times 10^{-5}$};
\node[below] at (6,0) {\footnotesize $1.2\times 10^{-4}$};
\node[below] at (8,0) {\footnotesize $1.6\times 10^{-4}$};
\draw[->,color=black] (0.,0.) -- (0.,1.1);
\foreach \y in {,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\clip(0.,0.) rectangle (8.5,1.);
\draw[line width=1.2pt,color=qqzzff,smooth,samples=100,domain=0.0:8.5] plot(\x,{0-0.0097*(\x)^(3.0)+0.096*(\x)^(2.0)-0.1006*(\x)+0.0493});
\draw[line width=1.2pt,color=wwccqq,smooth,samples=100,domain=0.0:8.5] plot(\x,{0-0.0023*(\x)^(3.0)+0.0087*(\x)^(2.0)+0.1103*(\x)+0.2326});
\draw[line width=1.2pt,color=ffdxqq,smooth,samples=100,domain=0.0:8.5] plot(\x,{0-2.0E-4*(\x)^(3.0)+8.0E-4*(\x)^(2.0)+0.0036*(\x)+0.4336});
\begin{scriptsize}
\draw [fill=qqqqff] (0.25,0.025) circle (2.5pt);
\draw [fill=qqqqff] (0.5,0.028) circle (2.5pt);
\draw [fill=qqqqff] (2.5,0.245) circle (2.5pt);
\draw [fill=qqqqff] (5.,0.738) circle (2.5pt);
\draw [fill=qqqqff] (7.5,0.614) circle (2.5pt);
\draw [color=ffqqqq] (5.5,0.74)-- ++(-2.0pt,-2.0pt) -- ++(4.0pt,4.0pt) ++(-4.0pt,0) -- ++(4.0pt,-4.0pt);
\draw[color=ffqqqq, right] (6.220444277733656,0.8009433424562268);
\node [color=ffqqqq, right] at (5.5, 0.74) {$(1.1\times 10^{-4}, 0.74)$};
\draw[color=qqzzff] (3.2539639594501097,0.05156399945292019);
\node [color=qqzzff, right] at (0,0.98) {$y_1= -1.209\times 10^{12}x^{3} + 2.4\times 10^{8}x^{2} - 5028.3x + 0.0493$};
\draw [fill=qqzzqq] (0.25,0.271) circle (2.5pt);
\draw [fill=qqzzqq] (0.5,0.277) circle (2.5pt);
\draw [fill=qqzzqq] (2.5,0.531) circle (2.5pt);
\draw [fill=qqzzqq] (5.,0.717) circle (2.5pt);
\draw [fill=qqzzqq] (7.5,0.593) circle (2.5pt);
\draw [color=ffqqqq] (5.5,0.7)-- ++(-2.0pt,-2.0pt) -- ++(4.0pt,4.0pt) ++(-4.0pt,0) -- ++(4.0pt,-4.0pt);
\draw[color=ffqqqq] (6.220444277733656,0.6503143287872204) node {$(1.1\times 10^{-4}, 0.70)$};
\draw[color=wwccqq] (2.8217615289717126,0.20219301312192653);
\node [color=wwccqq, right] at (0, 0.9) {$y_2 = -2.841\times 10^{11}x^{3} + 2.185\times 10^{7}x^{2} + 5514.2x + 0.2326$};
\draw [fill=ffzzqq] (0.25,0.435) circle (2.5pt);
\draw [fill=ffzzqq] (0.5,0.445) circle (2.5pt);
\draw [fill=ffzzqq] (2.5,0.449) circle (2.5pt);
\draw [fill=ffzzqq] (5.,0.429) circle (2.5pt);
\draw[color=ffdxqq] (2.7824703989282216,0.37165065349955867);
\node [color=ffdxqq, right] at (0, 0.82) {$y_3 = -2.304\times 10^{10}x^{3} + 2.051\times 10^{6}x^{2} + 180.1x + 0.4336$};
\draw [fill=ffzztt] (7.5,0.429) circle (2.5pt);
\end{scriptsize}
\end{tikzpicture}
\end{document}


And the result:

Thanks for suggestions!