答案1
这是使用该包的方法pgfplots
。可以使用 隐藏 y 轴上的刻度ymajorticks = false
。可以通过为 附加样式来获得虚线(或虚线) 。请注意,如果您使用的 y 轴没有值(但,即没有负 y 值),inner y axis line
它将是线。最后,可用于在物种值旁边显示物种名称,或任何其他基于文本的元数据。为此,启用(的默认选项是仅显示测量值)。outer
middle
left
nodes near coords
nodes near coords, point meta = explicit symbolic
nodes near coords
(顺便说一句,您提供的图像不显示堆积条形图。它只是一个普通的条形图)
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xbar,
xmin = -.5,
axis lines* = middle,
ymajorticks = false,
every inner y axis line/.append style = {dashed},
nodes near coords,
nodes near coords style = {anchor = west,font = \itshape},
point meta = explicit symbolic,
xtick = {-0.5,0,0.5,...,3.5},
xlabel = {$RS = \log (LC_{50Lf}/LC_{50i})$}
]
\addplot [fill=black!70] coordinates {
(3.75,1) [V. c. cochienis]
(2.75,2) [L. teres]
(2.50,3) [L. s. claibornensis]
(2.40,4) [A. pectorosa]
(2.40,5) [L. subviridis]
(2.30,6) [U. imbecillis]
(0.50,7) [C. rhizophorae]
};
\end{axis}
\end{tikzpicture}
\end{document}