- 我和有
xbar chart
关系。pgfplots
symbolic y coords
- 当其中一个条形的值大于
xmax
时,该条形就会消失。
- 我准备了一个例子,在一种情况下
xmax=10
称为,在另一种情况下称为。E
10=xmax
11>xmax
\documentclass[border=5mm,tikz]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xbar,
symbolic y coords = {A,B,C,D,E},
enlarge y limits = 0.15,
ytick = data,
width = 160mm,
height = 90mm,
xmin = 0,
xmax = 10,
title = {E = xmax},
]
\addplot coordinates {(1,A) (2,B) (3,C) (4,D) (10,E)};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[
xbar,
symbolic y coords = {A,B,C,D,E},
enlarge y limits = 0.15,
ytick = data,
width = 160mm,
height = 90mm,
xmin = 0,
xmax = 10,
title = {E $>$ xmax},
]
\addplot coordinates {(1,A) (2,B) (3,C) (4,D) (11,E)};
\end{axis}
\end{tikzpicture}