改变绘图颜色

改变绘图颜色

我想改变我的情节的颜色,所以我按照写的那样做这里,但什么都没改变。

顺便问一下,您能帮我理解为什么我的 2009 年的专栏没有绘制图表吗?这是我的 MWE

\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz} 
    \setlength{\parindent}{0pt}
    \usetikzlibrary{calc}
    \usetikzlibrary{backgrounds}
    \usetikzlibrary{chains}
    \usetikzlibrary{trees}
\definecolor{mycolor}{RGB}{8,108,131}
\usepackage{pgfplots}
    \pgfplotsset{compat=1.16} 


\pgfplotsset{
    cycle list={mycolor\\gray},
}
\begin{document} 
    \begin{tikzpicture}
        \begin{axis}[
            x tick label style={
                /pgf/number format/1000 sep=},
            ylabel=Time,
            legend style={at={(0.5,-0.2)},
            anchor=north,legend columns=1},
            ybar interval=0.7,
            xlabel=Requêtes
        ]
        \addplot 
            coordinates {(2012,1900) (2011,1500)
                 (2010,1746) (2009,1534)};%o0ur
        \addplot 
            coordinates {(2012,1043) (2011,947) 
                (2010,1550) (2009,1398)};%them
        \legend{Request,Request b}
        \end{axis}
    \end{tikzpicture}

\end{document} 

输出如下: 从上面的代码中

谢谢您的帮助

答案1

在一些位置,语法不太符合要求。尝试

\documentclass{article}
\usepackage{xcolor}
\definecolor{mycolor}{RGB}{8,108,131}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16} 


\pgfplotsset{ /pgfplots/bar cycle list/.style={/pgfplots/cycle list={
{mycolor,fill=mycolor!30!white,mark=none},
{gray,fill=gray!30!white,mark=none},
{brown!60!black,fill=brown!30!white,mark=none},
{black,fill=gray,mark=none},
}, },
}



\begin{document} 
    \begin{tikzpicture}
        \begin{axis}[
            x tick label style={
                /pgf/number format/1000 sep=},
            ylabel=Time,
            legend style={at={(0.5,-0.2)},
            anchor=north,legend columns=1},
            %ybar interval=0.7, 
            ybar=5pt,
            xtick={2009,...,2012},
            xlabel=Requ\^{e}tes
        ]
        \addplot 
            coordinates {
            (2012,1900) (2011,1500)
                 (2010,1746) (2009,1534) };%o0ur
        \addplot 
            coordinates { 
            (2012,1043) (2011,947) 
                (2010,1550) (2009,1398) };%them
        \legend{Request,Request b}
        \end{axis}
    \end{tikzpicture}

\end{document} 

在此处输入图片描述

相关内容