Example: Convergence Plot

Published 2014-03-15 | Author: Christian Feuersänger

We assume that we did some scientfic experiment. The scientific experiment yielded three input data tables: one table for each involved parameter d = 2, d = 3, d = 4. The data tables contain “degrees of freedom” and some accuracy measurement “l2_err”. In addition, they might contain some meta-data (in our case a column “level”).

What we want is to produce three plots, each dof versus l2_err, in a loglog plot. We expect that the result is a line in a loglog plot, and we are interested in its slope log e(N) = -a log(N) because that characterizes our experiment.

The code is from the PGFPlots 1.10 manual: “3.3 Solving a Real Use Case: Scientific Data Analysis”.

Download as: [PDF] [TEX]  •  [Open in Overleaf]

Convergence Plot

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de.

    title=Convergence Plot,
    xlabel={Degrees of freedom},
    ylabel={$L_2$ Error},
    legend entries={$d=2$,$d=3$,$d=4$},
\addplot table {data_d2.dat};
\addplot table {data_d3.dat};
\addplot table {data_d4.dat};
\addplot table[
     y={create col/linear regression={y=l2_err,
      variance list={1000,800,600,500,400,200,100}}}]
   % save two points on the regression line
   % for drawing the slope triangle
   coordinate [pos=0.25] (A)
   coordinate [pos=0.4]  (B)
% save the slope parameter:

% draw the opposite and adjacent sides
% of the triangle
\draw (A) -| (B)
     node [pos=0.75,anchor=west]
\addplot table {data_d2.dat}
   node [pos=1,pin=0:Special.] {}


Adding comments is currently not enabled.

There are currently 0 comments on this entry.

Scientific and technical areas

Creative Commons License