2

Usually I just use TikZ for plots but was hoping Pgfplots would simplify life (axis, labels, etc...) but I can not find what is the right syntax to pass parameters to the function. Here is the MWE:

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
   \pgfplotsset{compat=1.10}
   \begin{tikzpicture}
      \begin{axis}[
       title=Test,
       xlabel=$x$,
       ylabel=$f$,
       ]
          \foreach \y in {0,1,2,3}
             {\addplot[
             red,
             domain=0:1,
             samples=4,
              ]
              {x+\y};
             }
     \end{axis}
  \end{tikzpicture}
\end{document}
Sergio Parreiras
  • 1,786
  • 1
  • 15
  • 32

0 Answers0