带有笛卡尔平面的图形

带有笛卡尔平面的图形

如何在 LaTex 中绘制此图?我可以在笛卡尔平面中绘制它。

答案1

在此处输入图片描述

\documentclass{article}

\usepackage{pgfplots}
\usetikzlibrary{intersections,angles,quotes}
\usepgfplotslibrary{fillbetween}
%\pgfplotsset{compat=1.17}

\begin{document}
    
    \begin{tikzpicture}[scale=3]
        
        %grid lines
%       \draw[] 
%       (-1.4,-1.4) grid (1.4,1.4);
%       \filldraw[
%       fill=blue!20,
%       draw=red!50
%       ] 
%       (0,0) -- (3mm,0mm)
%       arc [
%       start angle=0, 
%       end angle=30, 
%       radius=3mm] 
%       -- cycle;
        %axes
        \draw[->] (-1.5,0) -- (1.5,0) coordinate (x axis);
        \draw[->] (0,-1.5) -- (0,1.5) coordinate (y axis);
        
        %axes label
        \node [right]at (1.5,0)(x){$x$};    
        \node [above]at (0,1.5){$y$};
        
        %circle 
%       \draw (0,0) circle [
%       radius=1cm
%       ];
        
        %triangle height
%       \draw[
%       very thick,
%       orange
%       ]
%       (30:1cm) -- node[
%       left=1pt,
%       fill=white
%       ] 
%       {$\sin \alpha$} (30:1cm |- x axis);
        
        %triangle base
        \path (30:1.2cm |- x axis)coordinate(a);
        \draw[ultra thick,blue](a) --  node[below]{$t$}(0,0);
        %intersection
        \path [name path=upward line] (a) -- ++(0,1.5);
        \path [name path=sloped line] (0,0) -- node [left=4pt,fill=white]
        {$n$} (30:1.2cm);
        \draw [name intersections={of=upward line and sloped line, by=t}]
        [very thick,red] 
        (a) -- node [right=1pt,fill=white]
        {$p$} (t);
        \draw (0,0) -- (t);
        
        %x-ticks
%       \foreach \x/\xtext in {-1, 
%           -0.5/-\frac{1}{2},
%           1}
%       \draw (\x cm,1pt) -- (\x cm,-1pt) node[
%       anchor=north,
%       fill=white
%       ] 
%       {$\xtext$};
        %y-ticks
%       \foreach \y/\ytext in {-1, 
%           -0.5/-\frac{1}{2}, 
%           0.5/\frac{1}{2}, 
%           1}
%       \draw (1pt,\y cm) -- (-1pt,\y cm) node[
%       anchor=east,
%       fill=white
%       ] 
%       {$\ytext$};
        %arc angle
        \draw (x) coordinate (A)-- 
        (0,0) coordinate (B)-- 
        (t) coordinate (C)
        pic [
        draw,
        red, 
        "$\alpha$",
        angle radius=9mm
        ] 
        {angle};
    \end{tikzpicture}
    
\end{document}

相关内容