1

So I am trying to draw a simple vector at the (-2,-2) point that is exactly 60 degrees. However, when I rotate, it places the arrow somewhere completely different. I do not know what else to do because putting in xshift or yshift options are too much guesswork involved. What do I do?

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,calc,positioning,decorations.pathreplacing,calligraphy}
\usepackage{tikzsymbols}

\begin{document}
\begin{tikzpicture}
\filldraw (-2,-2) circle (1.5pt);
\draw[thick] (-2,-2) ..controls +(60:1) and +(160:1) ..(0,-1)
            ..controls +(340:1) and +(250:1) ..(2.5,0);
\draw (-2.25,-2.25) rectangle (-1.75,-1.75);
\draw[-stealth,rotate=60,thick] (-2,-2)--(-1.5,-2);
\end{tikzpicture}

\end{document}
1
  • you could just use polar coordinates: \draw [-stealth,thick] (-2,-2) -- ++(60:0.5); Aug 19, 2020 at 13:58

2 Answers 2

1

By default, rotations are done around the origin point (0,0), to rotate around another point, it must be explicitly specified.

I quote the manual:

/tikz/rotate around={<degree>:<coordinate>} (no default)

Rotates the coordinate system by <degree> around the point <coordinate>.

\draw[-stealth,rotate around ={60:(-2,-2)},thick,blue] (-2,-2)node{x}--(-1.5,-2);

screenshot

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,calc,positioning,decorations.pathreplacing,calligraphy}
\usepackage{tikzsymbols}

\begin{document}
\begin{tikzpicture}
\filldraw (-2,-2) circle (1.5pt);
\draw[thick] (-2,-2) ..controls +(60:1) and +(160:1) ..(0,-1)
            ..controls +(340:1) and +(250:1) ..(2.5,0);
\draw (-2.25,-2.25) rectangle (-1.75,-1.75);
\draw[-stealth,rotate around ={60:(-2,-2)},thick,blue] (-2,-2)node{x}--(-1.5,-2);
\end{tikzpicture}

\end{document}
2

To long to be a comment ...

Do you looking for something like this:

enter image description here

Arrows is drawn by using polar coordinate:

\documentclass[tikz,border=3mm]{standalone}

\begin{document}
    \begin{tikzpicture}
\filldraw (-2,-2) circle (1.5pt);
\draw[thick] (-2,-2) ..controls +(60:1) and +(160:1) ..(0,-1)
            ..controls +(340:1) and +(250:1) ..(2.5,0);
\draw (-2.25,-2.25) rectangle (-1.75,-1.75);
\draw[-stealth] (-2,-2) -- ++ (60:1);
    \end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.