0

I have a list of quadratic equations e.g.

1.32663 - 2.40708*x + 2.41377*x^2, 0.872512 - 2.3468*x + 3.95037*x^2, 1.21842 - 3.33471*x + 4.49893*x^2, ...

Is there any way to quickly and easily plot all of these on one single set of axes using a variety of colours (there does not have to be a unique colour for each function but it would be good to have at least a handful of colours)

1
  • 2
    Add the plots in a \foreach (provided by pgf) loop inside the axis environment – Raven Sep 25 '19 at 8:52
5

You can do as @Raven suggest with one tilt, namely use \pgfplotsinvokeforeach (see section 8.1 Utility Commands of the pgfplots manual).

\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}
 \pgfplotsinvokeforeach{1.32663 - 2.40708*x + 2.41377*x^2, 0.872512 - 2.3468*x +
 3.95037*x^2, 1.21842 - 3.33471*x + 4.49893*x^2}{
 \addplot+[no marks] {#1};
 }
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.