使用这个答案https://tex.stackexchange.com/a/113669/37570我尝试将相同的设置应用到图形,但它不适用于中心轴线。
第一个图表的设置与链接答案相同,并且刻度是正确的,但 X 轴刚好在零之前开始,这是错误的。
第二个设置与我需要的在报告中显示的方式一致,但刻度不对。我应该进行哪些更改才能保留轴的布局,但仍保留 APA 刻度?
\documentclass[12pt,letterpaper,man,longtable]{apa6}
\usepackage{tikz,pgfplots}
\usetikzlibrary{arrows}
\shorttitle{R}
\begin{document}
\pgfplotsset
{
compat = newest,
every tick/.append style = thin
}
\pgfplotsset{
every non boxed x axis/.append style={x axis line style=-},
every non boxed y axis/.append style={y axis line style=-}
}
\begin{tikzpicture}[font=\tiny]
\begin{axis}[%
axis lines=left,
xtick align=inside,
ytick align=outside,
ymin=0,
ymax=30000000,
xmin=-10000000,
xmax=400000000,
samples=1000,
restrict y to domain=0:40000000,
]
\addplot[thick,color=red,domain=6500000:363000000,smooth] { 800918000000000000000/(x^2) };
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}[font=\tiny]
\begin{axis}[
xtick align=inside,
ytick align=outside,
axis x line=center,
axis y line=center,
axis line style={-triangle 45,shorten >=-10pt, shorten <=-10pt},
ymin=0,
ymax=30000000,
xmin=-10000000,
xmax=400000000,
samples=1000,
restrict y to domain=0:40000000,
]
\addplot[thick,color=red,domain=6500000:363000000,smooth] { 800918000000000000000/(x^2) };
\end{axis};
\end{tikzpicture}
\end{document}
答案1
经过实验,我发现如果将xtick
和ytick
移动到下面几行,一切就都正常了。
\begin{tikzpicture}[font=\tiny]
\begin{axis}[
axis x line=center,
axis y line=center,
axis line style={-triangle 45,shorten >=-10pt, shorten <=-10pt},
xtick align=inside,
ytick align=outside,
ymin=0,
ymax=30000000,
xmin=-10000000,
xmax=400000000,
samples=1000,
restrict y to domain=0:40000000,
]
\addplot[thick,color=red,domain=6500000:363000000,smooth] { 800918000000000000000/(x^2) };
\end{axis};
\end{tikzpicture}