I would like to produce a graph like I attached.
I started with drawing a coordinate system and adding 3 points, to create a triangle, but the reference is not the origin of the coordinate system… How could I get the attached graph?
\begin{center}
\begin{tikzpicture}
\begin{axis}[
%Same unit length
axis equal,
scale=1.5,
transform shape,
axis lines=middle,
axis line style={Stealth-Stealth, thick},
xmin=-8.5,xmax=8.5,ymin=-8.5,ymax=8.5,
xtick distance=1,
ytick distance=1,
xlabel=$x$,
ylabel=$y$,
title={},
grid=both,
grid style={line width=.1pt, draw=darkgray!10},
major grid style={line width=.2pt,draw=darkgray!50},
axis lines=middle,
%For plot of functions domain
domain = -8:8
]
\addplot[blue] {-1/2*x} node[above,pos=1] {};
\addplot[red] {2*x} node[above,pos=1] {};
\draw (10,8) node[anchor=north] {a}
-- (13,8) node[anchor=north]{b}
-- (18,14) node[anchor=south]{c}
-- cycle;
\end{axis}
\end{tikzpicture}
\end{center}
Best Answer
Since you seem to not know anything about TikZ yet, here's a simple solution without any fancy tricks, with straightforward commands that you may learn from. Note that this is not the best way to do that but one may start with something simple.