I want to draw hyperbola with pgfplots:
(x+1)^2/4-(y-2)^2/9=1
I want to draw hyperbola with pgfplots:
(x+1)^2/4-(y-2)^2/9=1
As stated in comments, you can reformulate the equation as "y = f(x)" with the problem of roots.
An alternative is to interprete it as "f(x,y)= (x+1)^2/4-(y-2)^2/9" and draw the contour "f(x,y) = 1" :
\documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \begin{document} \begin{tikzpicture} \begin{axis}[view={0}{90}] \addplot3[domain=-10:10, contour gnuplot={labels=false,levels={1}} ] {(x+1)^2/4-(y-2)^2/9}; \end{axis} \end{tikzpicture} \end{document} The value domain=-10:10 determines the computed range. Since domain y is missing, pgfplots assumes that it should also use -10:10.
Note that you need to compile this by means of pdflatex -shell-escape file.tex and you need gnuplot installed.
Note that the approach as such works for any kind of plot program, not just pgfplots.
I would strongly recommend googling around for a tikz/pgf tutorial to learn at least the basics on your own. You'll learn much more that way.
The most straightforward approach here is to solve for y=2±√(9*(x+1)^2/4-9) with x < -3 or 1 < x. Plotting this requires four commands, and results in
\begin{tikzpicture} \begin{axis}[xmin=-10,xmax=10,ymin=-10,ymax=10] \addplot[domain=-10:-3] {2+sqrt(9*(x+1)^2/4-9)}; \addplot[domain=-10:-3] {2-sqrt(9*(x+1)^2/4-9)}; \addplot[domain=1:10] {2+sqrt(9*(x+1)^2/4-9)}; \addplot[domain=1:10] {2-sqrt(9*(x+1)^2/4-9)}; \end{axis} \end{tikzpicture} This is not a great plot (there's the obvious gap on the left, and if you look closer, you'll see that the right has a few straight segments and angles near the vertex). To fix this, we can change to a parametric plot: x=2*sec(t)-1, y=3*tan(t)+2. Plotting this still requires two commands (to avoid the vertical asymptotes of sec and tan) and results in:
\documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \begin{document} \begin{tikzpicture} \begin{axis}[xmin=-10,xmax=10,ymin=-10,ymax=10] \addplot[domain=-89:89] ({2*sec(x)-1},{3*tan(x)+2}); \addplot[domain=91:269] ({2*sec(x)-1},{3*tan(x)+2}); \end{axis} \end{tikzpicture} \end{document} \documentclass[border=2pt]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[xmin=-10,xmax=10, ymin=-15, ymax=15, restrict x to domain=-20:20]% remove crossing lines at t=90 and t=270 \addplot[variable=t,domain=0:360,samples=200] ({2*sec(t)-1}, {3*tan(t)+2}); \end{axis} \end{tikzpicture} \end{document}