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'm trying to plot some points with sudden changes in the slope. But I get some strange behavior like this:

enter image description here

as you can see in the peaks, there is no smoothness in there.

However, I think the problem is the interpolation algorithm, because tikz uses bézier curves. So I'm wondering is there a way to overcome this problem?

I'm putting here just a sample of the data. However, I have several plots with these discontinuities, and I would like to get an automatic way of fixing them. If you need I can show more points in which discontinuities occur.



0.0000  0.0000
0.1561  0.8615
0.1614  0.8643
0.1669  0.8670
0.3619  0.8670
0.3679  0.8781
0.3739  0.8809
0.3799  0.8809
0.3858  0.8837
0.3918  0.8975
1.0000  1.0000

  no markers,
\addplot table [x index=0, y index=1] \datatable;

share|improve this question
It appears to me as if you have a lot of samples. If you can sample your underlying function so densely, you can probably use the default line style sharp plot instead of smooth. Your example immediately and automatically looks great if you uncomment smooth. Note that smooth should be considered as "draw something somehow nicely" rather than "interpolate strictly using high order interpolation". – Christian Feuersänger Dec 2 '11 at 20:54
up vote 1 down vote accepted

You can add and play with the tension=0.08 option to the axis (the smaller the number, sharper it gets within the scale [0,1].

But the main problem is you have groups of points too close to each other and suddenly jumps to a higher valued group which constrains the freedom of the turn and makes the interpolation ill-conditioned. I would suggest to leave out the too-close(!) points out, if possible.

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.