
Me gustaría dibujar una flecha en la parte vertical de una curva paramétrica. Considere, por ejemplo, la siguiente trochoida.
\documentclass{scrbook}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{
arrows.meta
, bending
, decorations.markings
}
\pgfplotsset{compat = 1.17}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width = 0.4\textwidth
, height = 0.25\textwidth
, axis equal
, axis lines = middle
, enlargelimits = false
, tick style = {draw = none}
, ymin = {0.0}
, xtick = \empty
, ytick = \empty
]
\addplot+[
no markers
, thick
, domain = -2.08869:8.37188
, smooth
, postaction = {decorate}
, decoration = {
markings
, mark = at position 0.132010 with {\arrow{Stealth[length = 2mm, bend]}}
, mark = at position 0.210413 with {\arrow{Stealth[length = 2mm, bend]}}
}
] ({x - 1.5 * sin(x r)}, {1.5 - 1.5 * cos(x r)});
\end{axis}
\end{tikzpicture}
\end{document}
Calculé las integrales correspondientes y sé que las posiciones de las partes "verticales" de la curva son 0,132 y 0,210 expresadas como una fracción de la longitud total. El resultado parece feo, porque aquí es donde se colocan las puntas de las flechas:
¿Cómo poner el centro de la flecha en estos puntos y no su punta?
También una pregunta secundaria: especifiqué "doblar", pero no parece doblado en absoluto. ¿Por qué?
Respuesta1
Ya que usted define explícitamente la longitud de las \arrow
marcas. Podría utilizar un decoration tranform
, consulte pgfmanual
§24.4.1. En el presente caso cambié las flechas a la mitad de su longitud.
Aquí está el resultado, con tu trama en azul y la tamizada en rojo selitransparente.
% arara: lwpdflatex
\documentclass{scrbook}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{
arrows.meta
, bending
, decorations.markings
}
\pgfplotsset{compat = 1.17}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width = 0.4\textwidth
, height = 0.25\textwidth
, axis equal
, axis lines = middle
, enlargelimits = false
, tick style = {draw = none}
, ymin = {0.0}
, xtick = \empty
, ytick = \empty
]
\addplot+[
no markers
, thick
, domain = -2.08869:8.37188
, smooth
, trig format=rad
, postaction = {decorate}
, decoration = {
markings
, mark = at position 0.132010 with {\arrow{Stealth[length = 2mm, bend]}}
, mark = at position 0.210413 with {\arrow{Stealth[length = 2mm, bend]}}
}
] ({x - 1.5 * sin(x)}, {1.5 - 1.5 * cos(x)});
\addplot+[
no markers
, thick,opacity=0.5
, domain = -2.08869:8.37188
, smooth
, trig format=rad
, postaction = {decorate}
, decoration = {
markings
, transform={xshift=1mm}
, mark = at position 0.132010 with {\arrow{Stealth[length = 2mm, bend]}}
, mark = at position 0.210413 with {\arrow{Stealth[length = 2mm, bend]}}
}
] ({x - 1.5 * sin(x)}, {1.5 - 1.5 * cos(x)});
\end{axis}
\end{tikzpicture}
\end{document}