0

I am trying now for a while to add an angle to my triangle, but unfortunately I receive the following error: "Package PGF Math Error: Unknown function `axis' (in 'axis cs')." My Latex code looks like the following:

\documentclass[12pt]{article}

\usepackage[german]{babel}

\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}
\usepackage{blindtext}
\usepackage{listofsymbols}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{xcolor}
\usepackage{longtable}
\usepackage{stmaryrd}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage{tkz-euclide}
\usepackage{calc}    
\begin{center}
    \begin{tikzpicture}
        \begin{axis}[
            axis lines=center,
            xtick={-1, 1},
            ytick={-1, 1},
            xlabel={$x$},
            ylabel={$y$},
            xlabel style={below right},
            ylabel style={above left},
            xmin=-1.5,
            xmax=1.5,
            ymin=-1.5,
            ymax=1.5,
            axis equal image]
            
            \draw[color=teal] (axis cs:0,0) -- (axis cs:0.71,0) -- (axis cs:0.71,0.71) -- cycle;
            \draw[fill=lightgray, thick] (axis cs: 0,0) -- (axis cs: 0,0) arc (axis cs: 0.71,0) node at (axis cs: 0.71,0.71) {$\alpha$} -- cycle;
            
            \draw(axis cs: 0,0) circle [radius=100];
        \end{axis}
    \end{tikzpicture}
    \end{center}~\\

The error appears while trying to draw a lightgray arc. Thanks for helping me out, JackboyPlay.

2
  • 1
    Welcome to TeX.SE!
    – Mensch
    Commented Oct 8, 2021 at 14:02
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.
    – erik
    Commented Oct 8, 2021 at 14:27

1 Answer 1

1

enter image description here

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        axis lines=center,
        xtick={-1, 1},
        ytick={-1, 1},
        xlabel={$x$},
        ylabel={$y$},
        xlabel style={below right},
        ylabel style={above left},
        xmin=-1.5,
        xmax=1.5,
        ymin=-1.5,
        ymax=1.5,
        axis equal image]
        
        \draw[color=teal] (0,0) -- (0.71,0) -- (0.71,0.71) -- cycle;
        \draw[fill=lightgray, thick] (0,0) -- (0.71,0) arc (0:45:0.71) -- cycle;
        \node at (22:.30)  {$\alpha$};% polar coordinate: 22 degrees, distance 0.30
        \draw(0,0) circle (1);
    \end{axis}
\end{tikzpicture}
\end{document}
4
  • Hey, thanks for helping me out with your answer. This works perfectly for me. Is there a possibility to decrease the size of the arc and add a letter, for example alpha, into it? ~JackboyPlay Commented Oct 8, 2021 at 14:56
  • Hi, just a simple comment: there is the vertex where is written \alpha that is out of the circle.
    – Sebastiano
    Commented Oct 8, 2021 at 15:50
  • @JackboyPlay I have moved the \alpha into the arc. To decrease the size of the arc, reduce the magic number 0.71 in the second draw command.
    – gernot
    Commented Oct 8, 2021 at 19:05
  • @Sebastiano thank you very much for your help and explanations! Unfortunately, I don't have enough reputation to upvote your answer. I'll definitely do it in the future! Commented Oct 9, 2021 at 7:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .