0

Using this answer https://tex.stackexchange.com/a/113669/37570 I tried to apply the same setup to a graph, but it did not work with the center axis lines.

The first graph is set up as in the linked answer and the ticks are correct, but the X axis starts just before zero, which is wrong.

The second one is set up the way I need it to appear in the report but the ticks are wrong. What should I change to keep the layout of the axis but still have the APA ticks?

\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}
ajeh
  • 2,572

1 Answers1

0

Experimenting, I just found that if the xtick and ytick were moved a few lines below, everything worked.

\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}
ajeh
  • 2,572