![如何从上到下标记 pgfplot?](https://linux22.com/image/424155/%E5%A6%82%E4%BD%95%E4%BB%8E%E4%B8%8A%E5%88%B0%E4%B8%8B%E6%A0%87%E8%AE%B0%20pgfplot%EF%BC%9F.png)
我刚开始在论文中使用 pgfplots 绘制图表。我使用的是双列布局,并希望创建图表时尽可能将它们放在单列中。
我觉得读者需要将头向左倾斜才能阅读 y 轴标签,这有点烦人。我想知道我是否可以将 y 轴标签设置为如下所示:
这是用于测试目的的小图表:
\begin{tikzpicture}
\begin{axis}[
ybar,
ymajorgrids,
axis lines* = left,
ylabel = {Lorem},
xlabel = {Ipsum},
xtick = {2016, 2017, 2018, 2019},
symbolic x coords = {2016, 2017, 2018, 2019},
]
\addplot[red!20!black,fill=red!80!white] coordinates
{(2016,58.8) (2017,93.7) (2018,96.5) (2019,96.4)};
\addplot[red!20!black,fill=blue!80!white]coordinates
{(2016,93.8) (2017,87.3) (2018,82.3) (2019,77.7)};
\end{axis}
\end{tikzpicture}
答案1
@abcdefg 提供的解决方案:
ylabel 样式 = {旋转 = -90, 对齐 = 居中},
ylabel = {L\o\r\e\m},
例子:
\begin{tikzpicture}
\begin{axis}[
ybar,
ymajorgrids,
axis lines* = left,
ylabel style = {rotate = -90, align = center},
ylabel = {L\\o\\r\\e\\m},
xlabel = {Ipsum},
xtick = {2016, 2017, 2018, 2019},
symbolic x coords = {2016, 2017, 2018, 2019},
]
\addplot[red!20!black,fill=red!80!white] coordinates
{(2016,58.8) (2017,93.7) (2018,96.5) (2019,96.4)};
\addplot[red!20!black,fill=blue!80!white]coordinates
{(2016,93.8) (2017,87.3) (2018,82.3) (2019,77.7)};
\end{axis}
\end{tikzpicture}