TikZ' datavisualization library and the package pgfplots (based on TikZ) both produce pretty nice plots in LaTeX. To someone starting to do that, what are the differences between the two and what may make one preferable to the other?

There is this question from 2012 and this one from 2014 basically asking the same question.

  • In the 2012 one the answer is that datavisualization is still experimental and thus recommends using pgfplots.
  • In the 2014 answer states that both are reasonable options. The differences pointed out here are
    • pgfplots is more mature
    • datavisualization is a bit more verbose

So, what is the current state of affairs? As a start, here are my thoughts after skimming through both documentations. Please expand on them and correct me, where I got the wrong impression.

  • pgfplots seems to support more plot types by default.
  • In datavisualization it seems to be very easy to add new plot types. Is the same true for pgfplots?
  • datavisualization is an inbuilt solution. This guarantees a very high degree of interoperability and consistency in the syntax with the rest of TikZ.
  • Both seem to come with very nice defaults.
  • I assume that both allow changing every aspects of how each elements of the plot is visualized.
  • pgfplots has a much larger user base, which means more help here.
  • Are there any differences in the capability to handle large amounts of input data?
  • Since datavisualization was added to TikZ after pgfplots already existed, I assume that the author deemed some of the design choices in pgfplots suboptimal.
  • 2
    I don't think a lot of people (or maybe even no one) uses datavisualization. At least on GitHub there are only very few bug reports for that component. On top I think it doesn't work with fpu, so the precision and accessible data range is very limited. Aug 5, 2019 at 10:17
  • 1
    @HenriMenke On page 843 of the manual it says: "Because of this, the data visualization engine does not use pgf’s standard representation of numbers and TeX dimensions and is does not use the standard parser when reading numbers in a data point. Instead, the fpu library, described in Section 56, is used to handle numbers."
    – schtandard
    Aug 5, 2019 at 10:24
  • 1
    I see, I only remember getting more ! Dimension too large with datavisualization than with pgfplots. Aug 5, 2019 at 10:25
  • 2
    AFAIK datavisualization has no equivalent of \addplot3. So you may want to specify the application range.
    – user121799
    Aug 5, 2019 at 15:43
  • 3
    @schtandard It is not just the dimensions but 3d ordering that is important here. pgfplots makes use of stuff that is part of pgfplotstable, too, which allows you to draw the stuff in the foreground last, such that it really looks 3d-like. This is a highly nontrivial achievement IMHO which for me makes the choice easy. If I was sure that I only need 2d plots, this question would be more delicate. Note also that I do not believe that the motivation for datavisualization was that there was something wrong with pgfplots.
    – user121799
    Aug 5, 2019 at 17:26

1 Answer 1


I cannot fully answer the question, but I'd say that there are two options.

  1. You cannot exclude that at a given point you want to produce 3d plots such as surface plots with either of these packages.
  2. You only want to produce 2-dimensional plots.

In the first case, you will inevitably have to rely on pgfplots. This is because pgfplots supports 3d ordering (all the keys of the type z buffer=sort and friends come into play here), which datavisalization currently does not. Most users like to have universal styles. For instance, you may want to have the arrow heads look the same for all plots and so on. This is arguably easiest if you do everything with the same package, which is pgfplots in this case.

In the second case, the situation is less clear. pgfplots is extremely powerful, but also somewhat complex. For instance, \foreach loops require special attention. This is nothing that cannot be learned, but if you have a very clear scope you may eventually be better off with datavisualization. (I personally would recommend to learn to deal with these pitfalls, they are to my knowledge all documented in the manual.)

Overall I feel that new users will in most cases be better off with pgfplots, also because there are way more examples available. For instance, there are about 100 times more posts tagged pgfplots on this site than datavisualization. True, some of them are duplicates, but nevertheless there are many more examples.

Needless to say that there are alternatives like tikz-3dplot, pstricks and asymptote. tikz-3dplot is a very powerful tool for drawing sketches and asymptote has a real 3d engine and many features that sometimes do not get as much appreciated as they could.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .