如何仅自定义一个坐标?

如何仅自定义一个坐标?
\documentclass{standalone}
\usepackage{pgfplots,tikz}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
      symbolic x coords={Germany,Spain,UK},
      xtick={Germany,Spain,UK},
      axis x line=bottom,
      axis y line=left,
      x tick label style={rotate=45},
      ymin=0,
      enlarge x limits={abs=0.5cm},
      ymax=110,
      ytick={0,10,...,100},
      ybar=6pt,
      bar width=14pt,
      ylabel=\% blablabla     
    ]
    \addplot[bar shift=0pt,fill=blue] coordinates {
        (Germany,10)
        };
    \addplot[bar shift=0pt,fill=red] coordinates {
         (Spain,30)       
        };
    \addplot[bar shift=0pt,fill=yellow] coordinates {
         (UK,40)       
        };    
\end{axis}
\end{tikzpicture}
\end{document}

我希望“德国”坐标为绿色且粗体。可以吗?

答案1

一种方法是使用xticklabels

在此处输入图片描述

代码:

\documentclass[border=2pt]{standalone}
\usepackage{pgfplots,tikz}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
      symbolic x coords={Germany,Spain,UK},
      xtick={Germany,Spain,UK},
      xticklabels={\bfseries\textcolor{green}{Germany},Spain,UK},
      axis x line=bottom,
      axis y line=left,
      x tick label style={rotate=45},
      ymin=0,
      enlarge x limits={abs=0.5cm},
      ymax=110,
      ytick={0,10,...,100},
      ybar=6pt,
      bar width=14pt,
      ylabel=\% blablabla     
    ]
    \addplot[bar shift=0pt,fill=blue] coordinates {
        (Germany,10)
        };
    \addplot[bar shift=0pt,fill=red] coordinates {
         (Spain,30)       
        };
    \addplot[bar shift=0pt,fill=yellow] coordinates {
         (UK,40)       
        };    
\end{axis}
\end{tikzpicture}
\end{document}

相关内容