How can I show the right angle between the blue and the red line? enter image description here

\pgfplotsset{compat=1.11}% at least 1.11

    axis equal=true,
    axis lines=middle, enlargelimits=false,
    xlabel={$x$},    ylabel={$y$},
    xlabel style={at={(ticklabel* cs:0.983)},anchor=west},
    ylabel style={at={(ticklabel* cs:1.03)}, anchor=north west, align=right},
    tick style={},
    x tick label style={below},
    y tick label style={left},
    xtick={}, ytick={},
    xticklabels={},   yticklabels={},
    after end axis/.code={
    \path(axis cs:0,0) 
    node [anchor=north east,xshift=0 cm] {O};}]
  \addplot[domain=-5:8,red] {5-x};
  \addplot[domain=-5:6,blue] {3+x};
  • did you check the library angles in pgfmanual?
    – Black Mild
    Oct 16 at 20:23

With pgfplots and using TikZ libraries angle and intersection:

Edit: Added are dot on angle mark sign.

\pgfplotsset{compat=1.18}% at least 1.11

    axis lines=middle,
    axis equal=true,
    xlabel={$x$},    ylabel={$y$},  label style={anchor=north east},
%    xtick=\empty,   ytick=\empty,
    tick label style={font=\scriptsize},
    no marks,
  \addplot +[name path=b] {5-x} coordinate (B);
  \addplot +[name path=r] {3+x} coordinate (R);
  \path [name intersections={of=b and r, by={C}}]
       pic [draw, angle radius=3mm,
            angle eccentricity=0.5, "$\cdot$"] {right angle=B--C--R}; % or $\bullet$, if you like more bold dot
\coordinate[label=below left:O] (O) at (0,0);
% add at end of axis if you like to have dashed lines between intersection and axis
%\draw[densely dashed, ultra thin] 
%        ([yshift=-2pt] O-|C) node[font=\scriptsize,below] {1}
%                             |- (O|-C) ;

enter image description here

  • Can we put a point in the middle of a right angle? @Zarko
    – cufcuf
    Oct 17 at 5:12
  • 1
    @cufcuf, yes. By use of quotes library. I will add this ASAP.
    – Zarko
    Oct 17 at 5:21
  • Thanks. It would be great, if we could also adjust the size of the right angle @Zarko
    – cufcuf
    Oct 17 at 5:24
  • One last thing, How do I send the right angle behind the lines? @Zarko
    – cufcuf
    Oct 17 at 5:57
  • 1
    @cufcuf, new problem, new question ;-). Try to use backgrounds library and insert \scoped[on background layer] before code for angle (if I understood you correctly).
    – Zarko
    Oct 17 at 6:07

You can use the right angle key from the library angles.

enter image description here

\draw[->] (-6,0)--(8,0) node[below]{$x$};   
\draw[->] (0,-2)--(0,11)  node[left]{$y$};
(0,0) node[below left]{O}
(1,0) node[below]{$1$}
(0,4) node[left]{$4$}
\draw[densely dotted] (1,4)--(1,0) (1,4)--(0,4);        
% the line y=3+x from x=-5 to x=6
(-5,-2) coordinate (A1)--
(6,9)   coordinate (A2) 
% the line y=5-x from x=-5 to x=8
(-5,10) coordinate (B1)--
(7,-2)  coordinate (B2)

(intersection of A1--A2 and B1--B2) coordinate (I)
pic[draw,angle radius=3mm,angle eccentricity=.5,pic text=$\cdot$]{right angle=B2--I--A2};
  • I start to believe that simplicity is not target of many people ^^
    – Black Mild
    Oct 17 at 5:13

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.