我问过如何将刻度标记从 x 轴下方移到 x 轴上方。(我使用了规范xticklabel shift=-16pt.
)在下图中,刻度标记位于图形具有水平渐近线的点。我需要将刻度标记向左或向右移动 2pt。
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=6in,axis equal image,unit vector ratio={2 1},clip=false,
axis lines=middle,
xmin=-1.5,xmax=2.5,
domain=-1.5:2.5, samples=201,
xlabel=$x$,ylabel=$y$,
ymin=-1,ymax=3,
restrict y to domain=-1:3,
enlargelimits={abs=0.5cm},
axis line style={latex-latex},
ticklabel style={font=\tiny,fill=white},
xtick={\empty},ytick={\empty},
extra x ticks={0.83333, 1, 1.6666},
extra x tick labels={$\frac{5}{6}$, $1$, $\frac{5}{3}$},
extra y ticks={-2},
extra y tick labels={$ma+b$},
yticklabel style={anchor=west},
yticklabel shift=-4pt,
ticklabel style={font=\tiny,fill=white},
xtick={0.83333, 1, 1.6666},ytick={\empty},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\addplot[samples=501,domain=-1.5:1,blue] {-1* x * abs((x - 1))^(1/5)};
\addplot[samples=501,domain=1:4,blue] {x * abs((x - 1))^(1/5)} node[below right,pos=0.75,font=\footnotesize]{$y=f(x)$};
\draw [fill] (0.83333,-0.58236) circle [radius=1.5pt];
\draw [fill] (1,0) circle [radius=1.5pt];
\draw [fill] (1.6666,1.53685) circle [radius=1.5pt];
\end{axis}
\end{tikzpicture}
\end{document}
答案1
因为你只想移动一勾选标记,最好只是用一点空格来调整它。所以像这样
extra x tick labels={$\frac{5}{6}$, \hspace*{0.5em}$1$, $\frac{5}{3}$}
产量:
代码:
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=6in,axis equal image,unit vector ratio={2 1},clip=false,
axis lines=middle,
xmin=-1.5,xmax=2.5,
domain=-1.5:2.5, samples=201,
xlabel=$x$,ylabel=$y$,
ymin=-1,ymax=3,
restrict y to domain=-1:3,
enlargelimits={abs=0.5cm},
axis line style={latex-latex},
ticklabel style={font=\tiny,fill=white},
%xtick={\empty},ytick={\empty},
extra x ticks={0.83333, 1, 1.6666},
extra x tick labels={$\frac{5}{6}$, \hspace*{0.5em}$1$, $\frac{5}{3}$},
extra y ticks={-2},
extra y tick labels={$ma+b$},
yticklabel style={anchor=west},
yticklabel shift=-4pt,
ticklabel style={font=\tiny,fill=white},
xtick={0.83333, 1, 1.6666},ytick={\empty},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\addplot[samples=501,domain=-1.5:1,blue] {-1* x * abs((x - 1))^(1/5)};
\addplot[samples=501,domain=1:4,blue] {x * abs((x - 1))^(1/5)} node[below right,pos=0.75,font=\footnotesize]{$y=f(x)$};
\draw [fill] (0.83333,-0.58236) circle [radius=1.5pt];
\draw [fill] (1,0) circle [radius=1.5pt];
\draw [fill] (1.6666,1.53685) circle [radius=1.5pt];
\end{axis}
\end{tikzpicture}
\end{document}