我想为整个文档设置一个配色方案。因此,我希望对于包含 2 条线的图,选择相距最远的两种颜色(例如蓝色和红色),对于包含 3 条线的图,选择蓝色、紫色、红色等。到目前为止,我只能使用预定义步骤让一个图正常工作,如我的 MWE 所示。有没有办法很好地做到这一点?谢谢!
\documentclass[border=2mm]{standalone}
\usepackage[cmyk]{xcolor}
\usepackage{pgfplots}
\usepackage[english]{babel}
\usepackage{pgfplots}
\usetikzlibrary{
pgfplots.colorbrewer,
}
\pgfplotsset{
cycle from colormap manual style/.style={
x=3cm,y=10pt,ytick=\empty,
stack plots=y,
every axis plot/.style={line width=2pt},
},
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
colormap name=viridis,
cycle list={
[colors of colormap={0,100,...,1000}]},
%
cycle from colormap manual style,
]
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\end{axis}
\end{tikzpicture}
\end{document}