TransWikia.com

Angle position away from inch.center

TeX - LaTeX Asked on January 26, 2021

The position of $phi$ is exactly at the center while I want it to be a little bit above the arc, is there a way to fix?

 usepackage{tikz}
 usetikzlibrary{angles, arrows.meta,   
            quotes}                
  usepackage{siunitx}    
   usepackage{xcolor}
definecolor{lava}{rgb}{0.81, 0.06, 0.13}
definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
usepackage{tikz-3dplot}
            

begin{document}
tdplotsetmaincoords{60}{110}
pgfmathsetmacro{rvec}{.8}
pgfmathsetmacro{thetavec}{30}
pgfmathsetmacro{phivec}{80}


begin{tikzpicture}[scale=5,tdplot_main_coords,ang/.style = {draw, Straight Barb-Straight Barb, anchor=center,label distance=20pt,angle radius = 8mm, angle eccentricity=1},arr/.style = {cap=round,-Straight Barb},]
coordinate (O) at (0,0,0);
tdplotsetcoord{P}{rvec}{thetavec}{phivec}

draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};

 
draw[-stealth,color=myblue] (O) -- (P);
tdplotsetcoord{P2}{0.9}{60}{80}
draw[-stealth,color=myblue] (O) -- (P2);
tdplotsetcoord{P3}{0.6}{60}{80}
pic [ang, "$phi$"] {angle = P2--O--P};

tdplotsetcoord{P5}{0.4*sqrt(3)}{60}{80}
draw[-stealth,color=red, dashed] (O) -- (P5);




end{tikzpicture}

end{document}

2 Answers

enter image description here

You can use --

pic [ draw,"$phi$",<->,angle radius=1cm] {angle = P2--O--P};

OR

enter image description here

pic [ draw,"$phi$",<->,angle radius=1cm, angle eccentricity=1.2] {angle = P2--O--P};

Correct answer by js bibra on January 26, 2021

I actually could solve it by changing angle eccentricity to 1.25

usepackage{tikz}
 usetikzlibrary{angles, arrows.meta,   
            quotes}                
  usepackage{siunitx}    
   usepackage{xcolor}
definecolor{lava}{rgb}{0.81, 0.06, 0.13}
definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
usepackage{tikz-3dplot}
            

begin{document}
tdplotsetmaincoords{60}{110}
pgfmathsetmacro{rvec}{.8}
pgfmathsetmacro{thetavec}{30}
pgfmathsetmacro{phivec}{80}


begin{tikzpicture}[scale=5,tdplot_main_coords,ang/.style = {draw, Straight Barb-Straight Barb, anchor=center,label distance=20pt,angle radius = 8mm, angle eccentricity=1.25},arr/.style = {cap=round,-Straight Barb},]
coordinate (O) at (0,0,0);
tdplotsetcoord{P}{rvec}{thetavec}{phivec}

draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};

 
draw[-stealth,color=myblue] (O) -- (P);
tdplotsetcoord{P2}{0.9}{60}{80}
draw[-stealth,color=myblue] (O) -- (P2);
tdplotsetcoord{P3}{0.6}{60}{80}
pic [ang, "$phi$"] {angle = P2--O--P};

tdplotsetcoord{P5}{0.4*sqrt(3)}{60}{80}
draw[-stealth,color=red, dashed] (O) -- (P5);




end{tikzpicture}

end{document}

Answered by Diana on January 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP