[Tex/LaTex] pgfplots – How to define one cycle list for all graphs (or the least amount possible)

pgfplots

Due to all the maintenance after changing a color in a list, I tried to define just one cycle list so I do not have to update all my lists anymore. It is all in all an annoyingly huge amount of time, which I rather spend on something else.

I already worked out a solved MWE and this is more of a question for reassurance. But if others are looking for a similar solution, this question might help them. I suppose there is one possible drawback to it: the font is also colored.

So: is this aproper way to define one single cycle list for the use with pgfplots?

Picture

enter image description here

MWE

\documentclass[
a4paper
]{scrartcl}

\usepackage{
amsmath,
tikz,
pgfplots,
pgfplotstable,
}

\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepgfplotslibrary{groupplots}

\pgfplotstableread[col sep=comma]{
Process,ValueA,ValueB
1,66,70
2,66,40
3,24,20
4,52,60
5,64,30
6,37,30
}{\tableabcdef}

\pgfplotscreateplotcyclelist{mycolorlisttest}{%
blue!60!black,fill=blue!60!black,every mark/.append style={fill=blue!60!black},mark=*\\%1
red!70!black,fill=red!70!black,every mark/.append style={fill=red!70!black},mark=*\\%2
green!70!black,fill=green!70!black,every mark/.append style={fill=green!70!black},mark=*\\%3
gray,fill=gray,fill=gray,fill=gray,every mark/.append style={fill=gray},mark=*\\%4
orange,fill=orange,every mark/.append style={fill=orange},mark=*\\%5
brown!80!black,fill=brown!80!black,every mark/.append style={fill=brown!80!black},mark=*\\%6
green,fill=green,every mark/.append style={fill=green},mark=*\\%7
violet!80!black,fill=violet!80!black,every mark/.append style={fill=violet!80!black},mark=*\\%8
black,fill=black,every mark/.append style={fill=black},mark=*\\%9
teal,fill=teal,every mark/.append style={fill=teal},mark=*\\%10
magenta!70!black,fill=magenta!70!black,every mark/.append style={fill=magenta!70!black},mark=*\\%11
yellow!90!black,fill=yellow!90!black,every mark/.append style={fill=yellow!90!black},mark=*\\%12
}

\begin{document}
\begin{center}
\begin{tikzpicture}[font=\small]
\begin{axis}[
xlabel={Force in N},
ylabel={Process},
%
xbar,
%
xmin=0,
%
enlarge x limits={rel={0.2}, upper},
%
ytick=data,
nodes near coords,
nodes near coords align={right=3pt},
every node near coord/.append style={fill=white, font=\footnotesize, inner sep=1pt},
%
cycle list name=mycolorlisttest,
no markers
]
\addplot+ table [x=ValueA, y=Process] {\tableabcdef};
\addplot+ table [x=ValueB, y=Process] {\tableabcdef};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}

SOLUTION

\documentclass[
a4paper
]{scrartcl}

\usepackage{
amsmath,
tikz,
pgfplots,
pgfplotstable,
}

\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepgfplotslibrary{groupplots}

\pgfplotstableread[col sep=comma]{
Process,ValueA,ValueB
1,66,70
2,66,40
3,24,20
4,52,60
5,64,30
6,37,30
}{\tableabcdef}

\tikzset{
meinemarkfarben/.style={
mark=*,
draw=#1,
fill=#1,
every mark/.append style={fill=#1}}
}

\pgfplotscreateplotcyclelist{aaaaaaa}{%
meinemarkfarben={yellow!60!black}\\%1
meinemarkfarben={red!70!black}\\%2
meinemarkfarben={green!70!black}\\%3
meinemarkfarben={gray}\\%4
meinemarkfarben={orange}\\%5
meinemarkfarben={brown!80!black}\\%6
meinemarkfarben={green}\\%7
meinemarkfarben={violet!80!black}\\%8
meinemarkfarben={black}\\%9
meinemarkfarben={teal}\\%10
meinemarkfarben={magenta!70!black}\\%11
meinemarkfarben={yellow!90!black}\\%12
}

\begin{document}
\begin{center}
\begin{tikzpicture}[font=\small]
\begin{axis}[
xlabel={Force in N},
ylabel={Process},
%
xbar,
%
xmin=0,
%
enlarge x limits={rel={0.2}, upper},
%
ytick=data,
nodes near coords,
nodes near coords align={right=3pt},
every node near coord/.append style={fill=white, font=\footnotesize, inner sep=1pt},
%
cycle list name=aaaaaaa,
no markers
]
\addplot+ table [x=ValueA, y=Process] {\tableabcdef};
\addplot+ table [x=ValueB, y=Process] {\tableabcdef};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}

Picture of Solution

enter image description here

Best Answer

This should be done by wrapping it around a custom style. I am not totally sure what you want?

Do this:

\tikzset{
  my mark set/.style={
    draw=#1,
    fill=#1,
    every mark/.append style={fill=#1}
  }
}

Then you can do:

\pgfplotscreateplotcyclelist{mycolorlisttest}{%
  my mark set=blue!60!black,mark=*\\%1
  my mark set=red!70!black,mark=*\\%2
  ...
}

You can of course utilise the special setting with the args such as:

\tikzset{
  my mark set/.style 2 args={
    mark=#1,
    draw=#2,
    fill=#2,
    every mark/.append style={fill=#2}
  }
}

and then do:

\pgfplotscreateplotcyclelist{mycolorlisttest}{%
  my mark set={*}{blue!60!black}\\%1
  my mark set={*}{red!70!black}\\%2
  ...
}