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.

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've constated that I can use tikzpicture even if I comment \usepackage{tikz} out, as long as I keep \usepackage{pgfplots}. Isn't tikzpicture provided by package tikz? In which situation should I load both pgfplots and tikz?

share|improve this question
Package pgfplots is based on tikz package. When you load it, it also load tikz. Actually it (simplified said) different axis environments to tikzpicture and simple and rich possibilities to draw graphs. – Zarko Jan 4 at 14:10
I'm guessing pgfplots is specialty use of tikz+pgf, thus it loads tikz. There is nothing wrong in loading both as latex make sure you do not accidentally loading, say, tikz twice – daleif Jan 4 at 14:12
up vote 10 down vote accepted

You can in a nutshell imagine that when you write \usepackage{pgfplots} some code in the pgfplots uses the equivalent of \usepackage{tikz} for you. TikZ also has other packages that it depends on (graphicx,xcolor,atbegshi and more) and it requires for you too. So you don't need to add those again.

If you load even only pgfplotstable it loads pgfplots, TikZ and hence xcolor, graphicx and so on many packages. LaTeX has an internal consistency check whether some package is already loaded or not. Hence requesting it twice wouldn't cause any harm (as long as there are no option clashes)

I usually add pgfplotstable to load all the relevant gang with minimal code.

pgfplots is written by one of the TikZ developers, Christian Feuersanger. However pgfplots development is independent from TikZ with certain libraries being synced such as fpu.

share|improve this answer
Although you have the TikZ manual burned into your brain, I find it helpful explicitly load the packages I use even if other packages load them as well. It's the best reminder of which documentation to look at when something goes wrong. – Alan Munn Jan 4 at 16:17

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.