Latex 使用pgfplot旋转yticklabels时出现问题

Latex 使用pgfplot旋转yticklabels时出现问题,latex,Latex,我正在使用“yticklab style={rotate=90}”将pgfplot中的ytick标签旋转90°。标签的文本未正确水平对齐 在下面的示例中,“Grouped”与其他标签不对齐(尤其是因为它包含“p”) 图片: 我已经没有“样式”选项来解决这个问题了,你知道如何使这些值水平对齐吗?谢谢 编辑: 最简单的示例(请注意,我的实际代码使用标签来寻址CSV文件中的列): \documentclass{article} %使用>>pdflatex进行翻译-外壳转义 %本文件是PGFPLOTS

我正在使用
“yticklab style={rotate=90}”
将pgfplot中的ytick标签旋转90°。标签的文本未正确水平对齐

在下面的示例中,“Grouped”与其他标签不对齐(尤其是因为它包含“p”)

图片:

我已经没有“样式”选项来解决这个问题了,你知道如何使这些值水平对齐吗?谢谢

编辑:

最简单的示例(请注意,我的实际代码使用标签来寻址CSV文件中的列):

\documentclass{article}
%使用>>pdflatex进行翻译-外壳转义
%本文件是PGFPLOTS手册的摘录,版权归Christian Feuersaenger所有。
% 
%只要您正确引用pgfplots手册,就可以随意使用它。
%
%看
%   http://pgfplots.sourceforge.net/pgfplots.pdf
%完整的手册。
%
%可以下载任何必需的输入文件(或表格包)
%在
% http://www.ctan.org/tex-archive/graphics/pgf/contrib/pgfplots/doc/latex/
%及
% http://www.ctan.org/tex-archive/graphics/pgf/contrib/pgfplots/doc/latex/plotdata/
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\页面样式{empty}
\开始{document}
\开始{tikzpicture}
\开始{轴}[
xbar,xmin=0,
宽度=12cm,高度=5.5cm,放大y极限=0.5,
xlabel={\#参与者},
符号y坐标={平坦,分组},
ytick=数据,
坐标附近的节点,坐标附近的节点对齐={水平},
yticklabel样式={rotate=90},
]
\addplot坐标{(3,平面)(7,分组)};
\结束{轴}
\结束{tikzpicture}
\结束{document}

带有
yticklebel样式={rotate=90,anchor=base,yshift=0.2cm}

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\pagestyle{empty}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    xbar, xmin=0,
    width=12cm, height=5.5cm, enlarge y limits=0.5,
    xlabel={\#participants},
    symbolic y coords={Flat,Grouped},
    ytick=data,
    nodes near coords, nodes near coords align={horizontal},
    yticklabel style={rotate=90,anchor=base,yshift=0.2cm},
    ]
    \addplot coordinates {(3,{Flat}) (7,Grouped)};
  \end{axis}
\end{tikzpicture}
\end{document}


(红线只是为了查看基线是否对齐)

在标签中插入
\strop
可能会有帮助,但这只是一个猜测,只要没有示例代码可供测试,我就使用
yshift=1ex
固定了y轴的偏移量。谢谢
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\pagestyle{empty}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    xbar, xmin=0,
    width=12cm, height=5.5cm, enlarge y limits=0.5,
    xlabel={\#participants},
    symbolic y coords={Flat,Grouped},
    ytick=data,
    nodes near coords, nodes near coords align={horizontal},
    yticklabel style={rotate=90,anchor=base,yshift=0.2cm},
    ]
    \addplot coordinates {(3,{Flat}) (7,Grouped)};
  \end{axis}
\end{tikzpicture}
\end{document}