I would like to build several Pareto diagram figures using a \newcommand, like this:
\documentclass[11pt]{amsart}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{xfp}
\definecolor{Azul}{rgb}{0.16, 0.32, 0.75}
\newcommand{\GraficoPareto}[9]{
\begin{tikzpicture}
\draw (0,0) rectangle (10,5);
\foreach \i/\j in {0/#6,2/#7,4/#8,6/#9,8/,10/}{
\draw (\i,2pt) -- (\i,-2pt) node[below] { \j };
}
\foreach \i in {0,1,...,5}{
\ifnum\i>0
\draw[densely dashed,gray] (-.1,\i) -- (10.1,\i) node[right] {\textcolor{black}{$\fpeval{20\i}%$}};
\else
\node[right,gray] (Texto) at (10.1,\i) {\textcolor{black}{$\fpeval{20\i}%$}};
\fi
\node[left] (Te) at (-0.1,\i) {$\fpeval{8\i}$};
}
\fill[Azul!100!black,opacity=0.8] (0.02,0) rectangle ({2-0.02},{#15/40});
\fill[Azul!100!black,opacity=0.8] (2.02,0) rectangle ({4-0.02},{#25/40});
\fill[Azul!100!black,opacity=0.8] (4.02,0) rectangle ({6-0.02},{#35/40});
\fill[Azul!100!black,opacity=0.8] (6.02,0) rectangle ({8-0.02},{#45/40});
\fill[Azul!100!black,opacity=0.8] (8.02,0) rectangle ({10-0.02},{#55/40});
\draw[line width=3pt,orange] (1,{5(#1/50)}) -- (3,{5((#1+#2)/50)}) -- (5,{5((#1+#2+#3)/50)}) -- (7,{5((#1+#2+#3+#4)/50)}) -- (9,{5*((#1+#2+#3+#4+#5)/50)});
\node (Legendax) at (5,-1) {Soma das horas};
\node (Legenday) at (-1,2.5) {\rotatebox{90}{Frequência}};
\end{tikzpicture}
}
\begin{document}
\GraficoPareto{30}{10}{5}{3}{2}{94}{194}{294}{394}
\end{document}
Whose result is this:
However, I would like to insert more two parameters (then 11), where I can to define the final x-labels. But this does not work.
How can I define this figure using 11 parameters?



#1to#9but theuser interface even with 9 is very hard to use and hard to read use eithr a key val list as Alan suggests or ifthe values really are a list and you wantto treat them all the same, use a comma list in a single argument – David Carlisle Feb 12 '22 at 21:43listofitemshttps://ctan.org/pkg/listofitems?lang=en or process with Lua – likethevegetable Feb 13 '22 at 14:56\GraficoParetocarry out\node (Legendax) at (5,-1) {Soma das horas}; \node (Legenday) at (-1,2.5) {\rotatebox{90}{Frequência}}; \end{tikzpicture}have\GraficoParetocall another macro which takes two arguments and does\node (Legendax) at (5,-1) {#1}; \node (Legenday) at (-1,2.5) {\rotatebox{90}{#2}}; \end{tikzpicture}and call the unextendible argument-monster as\GraficoPareto{30}{10}{5}{3}{2}{94}{194}{294}{394}{Soma das horas}{Frequência}. – Ulrich Diez Feb 14 '22 at 12:25