TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using TikZ to draw some conic-section graphs. There is a built-in ellipse command (semiaxes as two arguments) and a rudimentary parabola command (with a vertical axis, but one can rotate), but to draw a hyperbola I had to fake it with a spline and externally compute the control points. I don't want to plot a sequence of pixels, I'd prefer something parametric that can be easily modified. Is there a short-cut to draw a hyperbola just from the semiaxes and the centre location, within TikZ?

I'm not unhappy with spline approximations, they work fine for, say, cardioids, but is there some simpler way to get a hyperbola with TikZ?

share|improve this question
pgf plot doesn't plot pixels, but connects the points where it evaluates by lines or by some smoothed lines (I don't know what it does, but for sufficiently well-behaved functions it looks quite nicely). Thus I usually draw hyperbolas by plotting something like 1/x. – Caramdir Feb 1 '11 at 3:20
up vote 3 down vote accepted

Look at sections 19.5 and 19.6 in the pgf manual. You can plot curves given by simple parametric equations, such as

 \draw[scale=0.5,domain=-3.141:3.141,smooth,variable=\t] plot ({\t*sin(\t r)},{\t*cos(\t r)});

So if you van find parametric equations of your hyperbola, you should be able to plot it.

share|improve this answer

This should do the trick

\draw plot[variable=\t,samples=1000,domain=-35:35] ({sec(\t)},{tan(\t)});
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.