TeX - LaTeX Asked by lldbee on November 29, 2020
i tried to draw a angle between a line, and the X axis using pgfplots, i saw a lot of ways using tikz and other packages but, there is any way to do this using pgfplots?
documentclass{article}
usepackage{pgfplots}
begin{document}
begin{tikzfigure}
begin{axis}[
axis x line = center,
axis y line = center,
xlabel = $x$,
ylabel = $y$,
xmin=-1.0,
xmax=3.0,
ymin=-1.0,
ymax=3.0,
disabledatascaling,
axis equal,
]
addplot [->, color=blue] coordinates {(0, 0) (2, 3)};
end{axis}
end{tikzfigure}
end{document}
What can i write to get an angle like this?
Not directly, but I also do not see a need for that. But of course you can just define 3 coordinates and then use the angles
library to draw angles were needed.
% used PGFPlots v1.17
documentclass[border=5pt]{standalone}
usepackage{pgfplots}
usetikzlibrary{
angles,
quotes,
}
% use this `compat` level or higher so TikZ coordinates
% are in axis units by default
pgfplotsset{compat=1.11}
begin{document}
begin{tikzpicture}
begin{axis}[
axis lines=center,
xlabel=$x$,
ylabel=$y$,
xmin=-1.0,
xmax=3.0,
ymin=-1.0,
ymax=3.0,
disabledatascaling,
axis equal,
]
coordinate (xaxis) at (pgfkeysvalueof{/pgfplots/xmax},0);
coordinate (origin) at (0,0);
addplot [->,blue] coordinates {(0, 0) (2, 3)}
coordinate [at end] (A)
;
path (xaxis) -- (origin) -- (A)
pic [
draw,
->,
red,
angle radius=10mm,
angle eccentricity=1.2,
"$theta$",
] {angle = xaxis--origin--A}
;
end{axis}
end{tikzpicture}
end{document}
Correct answer by Stefan Pinnow on November 29, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP