1

I am writing my PhD thesis now, and want to plot some results (mainly the evolution of various simulation quantities on y-axis against time on the x-axis). I estimate to have around 50 such plots in my full thesis.

In the past, I have used tikz for scientific-illustrations (ie. artwork), not for a plot of f(t) vs t. But I cannot remember the tikz syntax now, although I can jog my memory given a couple of hours time.

For this task of function-plotting, in the tikz manual, there is an entire part (Part VI) devoted to data visualization. I also came across the pgfplots package which also uses PGF/Tikz as its base.

I understand the importance of having choices. So, I absolutely understand the goals and existence of the asympotote,metapost/metafun, pstricks-family and gnuplottex libraries/engines. Each serve a different target audience.

But once a user has decided to use the pgf engine for their graphics, isn't the effort better concentrated on a single choice and avoid duplication in efforts?

Personally, the real question (for me) is:

I probably have the time to learn just one package. Is there an objective comparison between pgfplots and tikz data visualization, i.e. the benefits and demerits of using one versus the other?

PS to moderators: I'd like this to be a community-wiki if possible, since lots of newcomers can benefit from an objective analysis of these packages to make an informed choice before diving into either.

  • My opinion: take pgfplots. According to what I understand, this is an "extension" of data visualization. That is, most of the things you can do with data visualization you can also do with pgfplots, but the converse is not true. – user121799 Jun 4 '18 at 13:52
  • @marmot It would be beneficial if you can provide more details or a list of "things you can do with pgfplots and not vice versa". Even if you start a small list in an answer, the moderators and other experienced users can add to it. – Krishna Jun 4 '18 at 13:54
  • 2
    @marmot, as far as I know first was TikZ without the data visualization library, than came pgfplots and I think with tikz v3 the data visualization library was added ... And thus these are "competing" packages to plot data. – Stefan Pinnow Jun 4 '18 at 13:59
  • @StefanPinnow Yes. I noticed that too, having looked at an old version of the manual. I wonder what good can result from that? It just leads to fragmentation. Two solutions using the same pgf engine, when the efforts can be concentrated on making a single one even better. That said, is there a comparison, maybe on "ease of use, capabilities etc."? – Krishna Jun 4 '18 at 14:04
  • 2
    If you scroll through the part in the TikZ manual about the datavisualization library, and compare that to the table of of contents for pgfplots, one thing at least is obvious: pgfplots (currently) has support for a much wider variety of plots. datavisualization does not do for example, bar plots, comb plots and box plots. – Torbjørn T. Jun 4 '18 at 14:07
2

As far as I can see, the datavisualization library can currently handle only two types of plots: line plots and scatter plots. If you want any other type of plot, you need to create your own "visualizer". The manual does describe how to do that, but I suspect most users wouldn't want to.

pgfplots on the other hand can also make things like bar plots, histograms, box plots, comb plots, area plots and quiver plots. So pgfplots currently has a wider range of plot types supported.

1

Personally I would take pgfplots, which is, of course based on TikZ. Simple argument: pgfplots has over 500 pages of documentation whereas the data the data visualization part of the pgfmanual "only" less than 120. This already suggests that it is mightier. But it is probably an illusion to assume that you'll get away with "only" reading the pgfplots manual if you want to really use the package. So far I have not seen any feature of data visualization that cannot be achieved with pgfplots. On the other hand, things like \addplot3 seem not to be available in data visualization, nor all the nice features involving tables.

Note that this is only a personal assessment.

  • thank you for your answer, especially the point about addplot3. I shall wait to see if more aspects of comparison will be provided by others. – Krishna Jun 4 '18 at 14:09
  • Flip-side: You may (I do) prefer the data-visualisation syntax to that of pgfplots. If it does what you need, it's simpler - partly because there are 400-odd fewer pages to hunt through. The pgfplots manual is overwhelming. It takes me forever to find what I need and what I need is usually scattered in different parts of the manual. If you need pgfplots, you need it. But if you don't, why deal with the extra complexity? Can pgfplots use external helpers in the same way as TikZ (e.g. gnuplot). @Krishna – cfr Jun 5 '18 at 0:33
  • @cfr If you are asking whether pgfplots can use external programs such as gnuplot the answer is yes. – user121799 Jun 5 '18 at 2:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.