提问于:
浏览数:
2095
```
\documentclass[a4paper]{article}
\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer}
\pgfplotsset{width=7cm,compat=1.13}
\begin{document}
\begin{tikzpicture}
\begin{loglogaxis}[
title=Convergence Plot,
xlabel={Degrees of freedom},
ylabel={$L_2$ Error},
grid=major,
legend entries={$d=2$,$d=3$,$d=4$,$d=5$},
]
\addplot table {data_d2.dat};
\addplot table {data_d3.dat};
\addplot table {data_d4.dat};
\addplot table[
x=dof,
y={create col/linear regression={y=l2_err,
variance list={1000,800,600,500,400,200,100}}]
{data_d4.dat};
\end{loglogaxis}
\end{tikzpicture}
\end{document}
```