# How to draw this curve when the coordinates of the points too large?

I want to draw the graph of the function $y = \dfrac{21 x + 9}{x+9}$ and $A(-13, 66)$, $B(1, 3)$, $C(-69, 24)$, and $G(-27, 31)$. I used Geogebra to draw. This is my code

\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{qqqqff}{rgb}{0,0,1}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw[->,color=black] (-76.11,0) -- (66.76,0);
\foreach \x in {-70,-60,-50,-40,-30,-20,-10,10,20,30,40,50,60}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0,-2.85) -- (0,71.31);
\foreach \y in {,10,20,30,40,50,60,70}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\clip(-76.11,-2.85) rectangle (66.76,71.31);
\draw[smooth,samples=100,domain=-76.10871873047131:66.75686693800155] plot(\x,{(21*(\x)+9)/((\x)+9)});
\draw (-13,66)-- (1,3);
\draw (1,3)-- (-69,24);
\draw (-69,24)-- (-13,66);
\begin{scriptsize}
\fill [color=qqqqff] (-13,66) circle (1.5pt);
\draw[color=qqqqff] (-12.13,67.71) node {$A$};
\fill [color=qqqqff] (1,3) circle (1.5pt);
\draw[color=qqqqff] (3.4,3.23) node {$B$};
\fill [color=qqqqff] (-69,24) circle (1.5pt);
\draw[color=qqqqff] (-69.52,21.5) node {$C$};
\fill [color=qqqqff] (-27,31) circle (1.5pt);
\draw[color=qqqqff] (-26.17,28.33) node {$G$};
\end{scriptsize}
\end{tikzpicture}
\end{document}


The picture has coordinates of point too large. I can not view when I run code. How to draw this picture?

-
Use x=1.0mm,y=1.0mm instead of x=1.0cm,y=1.0cm in tikzpicture options. – Harish Kumar Sep 16 '13 at 16:10

When you use x=1.0cm,y=1.0cm as unit length, the node \draw[color=qqqqff] (-69.52,21.5) node {$C$}; (for example) lies 69.52cm to the left of your page. That is clearly falling outside the page margins. Hence reducing unit lengths is necessary. You may use x=1.0mm,y=1.0mm for example.

\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{qqqqff}{rgb}{0,0,1}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0mm,y=1.0mm]    %%% <-- this line modified
\draw[->,color=black] (-76.11,0) -- (66.76,0);
\foreach \x in {-70,-60,-50,-40,-30,-20,-10,10,20,30,40,50,60}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0,-2.85) -- (0,71.31);
\foreach \y in {,10,20,30,40,50,60,70}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\clip(-76.11,-2.85) rectangle (66.76,71.31);
\draw[smooth,samples=100,domain=-76.10871873047131:66.75686693800155] plot(\x,{(21*(\x)+9)/((\x)+9)});
\draw (-13,66)-- (1,3);
\draw (1,3)-- (-69,24);
\draw (-69,24)-- (-13,66);
\begin{scriptsize}
\fill [color=qqqqff] (-13,66) circle (1.5pt);
\draw[color=qqqqff] (-12.13,67.71) node {$A$};
\fill [color=qqqqff] (1,3) circle (1.5pt);
\draw[color=qqqqff] (3.4,3.23) node {$B$};
\fill [color=qqqqff] (-69,24) circle (1.5pt);
\draw[color=qqqqff] (-69.52,21.5) node {$C$};
\fill [color=qqqqff] (-27,31) circle (1.5pt);
\draw[color=qqqqff] (-26.17,28.33) node {$G$};
\end{scriptsize}
\end{tikzpicture}
\end{document}


-

Without prolix output with GeoGebra.

\documentclass[pstricks,border=15pt]{standalone}
\usepackage{pst-plot,pst-eucl}
\psset{algebraic,unit=1mm}

\def\f[#1]{(21*#1+9)/(#1+9)}
%\def\f[#1]{(21*(#1)+9)/(#1+9)}% <--- it is still valid for \f[a+b]

\begin{document}
\begin{pspicture}(-70,-10)(70,70)
\pstGeonode[PosAngle={45,-45,-90,-45}]
(*-13 \f[x]){A}
(*3 \f[x]){B}
(*-60 \f[x]){C}
(*-30 \f[x]){D}
\psaxes[Dx=10,Dy=10]{->}(0,0)(-70,-10)(70,70)[$x$,0][$y$,90]
\psplot[yMaxValue=70,yMinValue=-10,plotpoints=1500,linecolor=blue]{-70}{70}{\f[x]}
\pspolygon[linestyle=dashed](A)(B)(C)
\end{pspicture}
\end{document}


-
I like your code. But I can not view. I got a massage MiKTeX GPL Ghostscript 9.05: Unrecoverable error, exit code 1. Please help me. – minthao_2011 Sep 17 '13 at 4:35
@minthao_2011: You need to compile it with either latex->dvips->ps2pdf sequence or xelatex. – kiss my armpit Sep 17 '13 at 4:42