Book Image

LaTeX Graphics with TikZ

By : Stefan Kottwitz
5 (3)
Book Image

LaTeX Graphics with TikZ

5 (3)
By: Stefan Kottwitz

Overview of this book

In this first-of-its-kind TikZ book, you’ll embark on a journey to discover the fascinating realm of TikZ—what it’s about, the philosophy behind it, and what sets it apart from other graphics libraries. From installation procedures to the intricacies of its syntax, this comprehensive guide will help you use TikZ to create flawless graphics to captivate your audience in theses, articles, or books. You’ll learn all the details starting with drawing nodes, edges, and arrows and arranging them with perfect alignment. As you explore advanced features, you’ll gain proficiency in using colors and transparency for filling and shading, and clipping image parts. You’ll learn to define TikZ styles and work with coordinate calculations and transformations. That’s not all! You’ll work with layers, overlays, absolute positioning, and adding special decorations and take it a step further using add-on packages for drawing diagrams, charts, and plots. By the end of this TikZ book, you’ll have mastered the finer details of image creation, enabling you to achieve visually stunning graphics with great precision.
Table of Contents (18 chapters)

Filling the area between plots

In Chapter 7, Filling, Clipping, and Shading, we dealt with filling areas enclosed by TikZ paths. Now we will do the same with plots.

You may remember the integral of a function over an interval: it represents the exact area between the curve and the x-axis over the interval. Let’s see how to visualize this.

The fillbetween library provides ways to fill areas between plots and axes. You can load it this way:

\usepgfplotslibrary{fillbetween}

Let’s look at the axes and how we can access them as TikZ paths. pgfplots has its own coordinate system that can be accessed using the axis cs prefix. Using this, the plot coordinate system coordinates are translated to TikZ coordinates. So, in TikZ, we can work with a coordinate (axis cs:1,2) which is the coordinate (1,2) in the plot coordinate system, no matter what its TikZ size is.

In the following example, we give a plot a path name. Then, we define a TikZ path with axis cs coordinates...