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 am trying to plot a naca0012 airfoil profile by its analytic function ( cf wikipedia ) using tikz and I can't understand why I get the following results. I precise that I get the same results if I use gnuplot in tikz \draw plot function. It seems to badly compute the 4 first percent of the plot. If I change to domain=0.:0.05, I also get the 4 first percent of domain=0.:0.05 wrong.

what am I wrong ? Should I specified a tikz option somehow ?




  \draw[step=.02,gray,very thin] (-0.1,-0.1) grid (1.1,0.15);

  \draw[color=red,domain=0.:1.,scale=5] plot[id=naca] (\x,{0.12/0.2*(0.2969*sqrt(\x )-0.126*\x -0.3516*\x^2 +0.2843*\x^3 -0.1015*\x^4 )}) ;
  \draw[color=blue,domain=0.:.05,yshift=1] plot[id=naca] (\x,{0.12/0.2*(0.2969*sqrt(\x )-0.126*\x -0.3516*\x^2 +0.2843*\x^3 -0.1015*\x^4 )}) ;



produces enter image description here

share|improve this question
I am not understanding exactly what is it that is "wrong" with the output? – Peter Grill Feb 9 '12 at 8:24
up vote 10 down vote accepted

The plot is linear between sampling points. To reach a better resolution (and therefore make the plot smoother) use the samples option, i.e.

\draw[domain=0.:1.,samples=400] plot[id=naca] (\x,{0.12/0.2*(0.2969*sqrt(\x )-0.126*\x -0.3516*\x^2 +0.2843*\x^3 -0.1015*\x^4 )}) ; 

You can see the sampling points if you add the marks=+ (or * or x, if your prefer). To adjust for your scaling, the size of the markers need to be reduced.

\draw[domain=0.:1.,samples=100] plot[id=naca,mark=+,mark size=0.1] (\x,{0.12/0.2*(0.2969*sqrt(\x )-0.126*\x -0.3516*\x^2 +0.2843*\x^3 -0.1015*\x^4 )}) ;   

Also, instead of using a high sample count, you can supply smooth to get a better interpolation algorithm.

You may also want to look at the pgfplots package.

share|improve this answer
Thanks a lot. Do you know how to plot the sampling points ? – Sigmun Feb 9 '12 at 9:34
@Sigmun Take a look at my edit. – Psirus Feb 9 '12 at 9:52

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.