Featured Book

LaTeX Beginners Guide

Supporters and Partners

Sponsored by DANTE e.V.: The German speaking TeX Users Group
TeXnique.fr - questions et réponses sur LaTeX
TeXwelt - Fragen und Antworten zu LaTeX
TeXblog
TeXample
pgfplots 1.10 released PDF Print E-mail
News - LaTeX Graphics, Figures & Tables
Written by Stefan Kottwitz   
Friday, 07 March 2014 16:19

Version 1.10 of pgfplots has been released. It offers a new solution for fill the area between plots. Until now, people could use stacked plots to achieve such fillings or program it on their own. pgfplots now does it also with a focus on a minimum of required compiling time.

You can use it this way:

  • Load the library fillbetween: \usepgfplotslibrary{fillbetween}
  • Give the plots a name via name path=plot1 etc.
  • Add a fill between plot, such as
\addplot fill between[ 
  of = plot1 and plot2, 
  split,
  every even segment/.style = {color1},
  every odd segment/.style  = {color2},
];
Elke posted a complete example on TeXwelt.de:
\documentclass[margin=5mm]{standalone} 
\usepackage{pgfplots}
\pgfplotsset{compat=1.10} % mit writeLaTeX bisher noch nicht möglich
\usepgfplotslibrary{fillbetween}
\usepackage{filecontents}

\begin{filecontents}{plotdata.dat}
-2.5 0.5 -0.5 
-1 -1 1
0 0 0
1 1 -1
2.5 -0.5 0.5 
\end{filecontents}

\begin{document} 
\begin{tikzpicture} 
\begin{axis}
  \addplot[name path=plot1,green]table[x index={0}, y index={1}]{plotdata.dat}; 
  \addplot[name path=plot2,red]table[x index={0}, y index={2}]{plotdata.dat};
  % Füllung zwischen plots
  \addplot fill between[ 
    of=plot1 and plot2, 
    split, % Segmente berechnen lassen, Zählung beginnt bei 0 (also gerader Zahl)
    every even segment/.style= {green!10}, % Stil für die geraden Segmente
    every odd segment/.style={red!10}, % Stil für die ungeraden Segmente
 ]; 
\end{axis} 
\end{tikzpicture} 
\end{document}
Filled segments between plots

You can download the new version from SourceForge or from CTAN.

 

Comments

Please login to post comments or replies.
 

Latest Forum Posts



Re: Metafile to EPS converter: should it work from within LY
01/11/2016 15:21, scottkosty

Re: Use TikZ with LyX
01/11/2016 14:34, jonjoexx

Re: Metafile to EPS converter: should it work from within LY
01/11/2016 09:49, Stef Pillaert

Re: Metafile to EPS converter: should it work from within LY
01/11/2016 00:07, scottkosty

Re: Android
31/10/2016 19:16, Stefan Kottwitz

Re: Metafile to EPS converter: should it work from within LY
31/10/2016 17:24, Stef Pillaert

Re: Metafile to EPS converter: should it work from within LY
31/10/2016 14:51, scottkosty

Re: customizing screen font size
31/10/2016 14:50, scottkosty

Re: hyperlinks in tikz
31/10/2016 06:55, omerangel

customizing screen font size
30/10/2016 20:22, jalea148