我刚开始在论文中使用 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}