Take the 2-minute tour ×
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.

I want to do a simple plot of goniometric functions with pgf in a beamer presentation:

% ...
    \begin{axis}\addplot[domain=0:pi]{sin(deg(x))}; \end{axis}

The domain options seems to be ignored, x axis spans from -6 to +6 regardless of what I specify. I tried to use /pgf/domain instead, with no change. What am I missing?

share|improve this question
It works for me as intended that is from 0 to pi. Is it possible that you complete your code to a compilable full example? –  percusse Nov 7 '11 at 11:11
This code works for me with a correct domin, perhaps check your pgfplot version (\listfiles) and update. I used version 1.4.1, the most recent one is 1.5. –  Stefan Kottwitz Nov 7 '11 at 11:14
I am unfrotunately at Ubuntu which still has TeXlive 2009, with pgfplots 1.2.2. Thanks for answers. Is there a way to close the question? Or can @Stefan Kottwitz convert the comment to answer? –  eudoxos Nov 7 '11 at 12:05
@eudoxos I added an answer. Perhaps somebody having the same problem might find this question with google and so sees the update recommendation. –  Stefan Kottwitz Nov 7 '11 at 12:34
add comment

2 Answers

up vote 5 down vote accepted

The code works, tested with pgfplots version 1.4.1.

On Ubuntu the current version from the repositories is 1.2.2, as the OP commented, which should be the cause. So an upgrade of pgfplots is recommended, which could be done manually from CTAN the most recent version is 1.5. However, when upgrading I recommend upgrading also the PGF package to the most recent version, for best compatibility.

share|improve this answer
I upgraded to vanilla TeXLive and it works now. Thanks for tip. –  eudoxos Nov 7 '11 at 13:27
add comment

Have you tried passing the domain option to tikzpicture instead of to the \addplot command? Works for me with 1.2.2.




    \begin{axis}[ xlabel=$x$,
                  ylabel=$y$ ]
    \addplot[blue,dashed] {x^(2)};
    \addplot[green] {x^(3)};

share|improve this answer
add comment

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.