如何在极轴环境中将标签正确定位在 -90 度到 +90 度之间,并且数据朝南?理想情况下,yaxis(0...1.0)将垂直排列在左侧居中。有什么建议吗?
\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[
rotate=-90,
xmin=-90,
xmax=90,
xtick={-90,-60,-30,0,30,60,90}
]
\addplot coordinates {(-60,1) (10,0.8) (80,0.2)};
\end{polaraxis}
\end{tikzpicture}
\end{document}
答案1
调整旋转极轴的标签是 PGFPlots 目前缺少的功能,但你可以通过将以下代码(取自极坐标图 x 和 y 刻度和单位)到你的序言中:
\makeatletter
\def\pgftransform@angle{0}
\pgfplotsset{
xticklabel style={
inner xsep=1pt,
ellipse,
anchor=\tick-(180-\pgftransform@angle)
},
yticklabel style={
anchor=\pgftransform@angle
}
}
\makeatother
完整代码:
\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\usetikzlibrary{shapes.geometric}
\makeatletter
\def\pgftransform@angle{0}
\pgfplotsset{
xticklabel style={
inner xsep=1pt,
ellipse,
anchor=\tick-(180-\pgftransform@angle)
},
yticklabel style={
anchor=\pgftransform@angle
}
}
\makeatother
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[
rotate=-90,
xmin=-90,
xmax=90,
xtick={-90,-60,-30,0,30,60,90}
]
\addplot coordinates {(-60,1) (10,0.8) (80,0.2)};
\end{polaraxis}
\end{tikzpicture}
\end{document}