当“条形宽度”以轴单位定义且“条形移位自动 = 0”时,条形位置不正确

当“条形宽度”以轴单位定义且“条形移位自动 = 0”时,条形位置不正确

在调整一些轴选项时,我发现了这种奇怪的行为。设置单位bar widthbar shift auto不设置单位时,条形图的位置不正确。日志中没有警告或错误消息。

这真的是一个错误吗,或者我错过了什么?

% arara: pdflatex
\documentclass[tikz]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepackage{times}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[width=7cm,height=7cm,bar shift auto=0pt]
        \addplot[ybar, bar width=1, fill=blue] coordinates {(10,5) (15,10) (5,15) (24,20) (30,25)};
        \addplot[ybar, bar width=1, fill=red]  coordinates {(10,5) (15,10) (5,15) (24,20) (30,25)};
        \node[anchor=north west] at (rel axis cs:0,1) {bar shift auto=0pt,bar width=1};
    \end{axis}
\end{tikzpicture}
\begin{tikzpicture}
    \begin{axis}[width=7cm,height=7cm,bar shift auto=0]
        \addplot[ybar, bar width=1, fill=blue] coordinates {(10,5) (15,10) (5,15) (24,20) (30,25)};
        \addplot[ybar, bar width=1, fill=red]  coordinates {(10,5) (15,10) (5,15) (24,20) (30,25)};
        \node[anchor=north west] at (rel axis cs:0,1) {bar shift auto=0,bar width=1};
    \end{axis}
\end{tikzpicture}
\begin{tikzpicture}
    \begin{axis}[width=7cm,height=7cm,bar shift auto=0pt]
        \addplot[ybar, bar width=5pt, fill=blue] coordinates {(10,5) (15,10) (5,15) (24,20) (30,25)};
        \addplot[ybar, bar width=5pt, fill=red]  coordinates {(10,5) (15,10) (5,15) (24,20) (30,25)};
        \node[anchor=north west] at (rel axis cs:0,1) {bar shift auto=0pt,bar width=5pt};
    \end{axis}
\end{tikzpicture}
\begin{tikzpicture}
    \begin{axis}[width=7cm,height=7cm,bar shift auto=0]
        \addplot[ybar, bar width=5pt, fill=blue] coordinates {(10,5) (15,10) (5,15) (24,20) (30,25)};
        \addplot[ybar, bar width=5pt, fill=red]  coordinates {(10,5) (15,10) (5,15) (24,20) (30,25)};
        \node[anchor=north west] at (rel axis cs:0,1) {bar shift auto=0,bar width=5pt};
    \end{axis}
\end{tikzpicture}%
\end{document}

在此处输入图片描述

相关内容