TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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 would like to know whether and how the pgfplots package can be used to produce a plot with two curves using different scales, like in the following example: enter image description here

share|improve this question
up vote 9 down vote accepted

See section 4.8.10 – "Two Ordinates (y axis) or Multiple Axes" – in the pgfplots manual. The following is ripped from the first example (with preamble added):





    scale only axis,
    axis y line*=left,% the ’*’ avoids arrow heads
    ylabel=First ordinate]
  \addplot {x^2};
    scale only axis,
    axis y line*=right,
    axis x line=none,
    ylabel=Second ordinate]
    \addplot[red] {3*x};

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.