PGFPlot에서 부분적으로 만 보이는 포인트 라벨

Sep 06 2020

다음 플롯에 라벨을 추가하고 싶지만 축이 작아서 일부만 볼 수 있습니다. 전체 레이블을 볼 수 있도록 플롯에 "가상 공간"을 추가하는 방법이 있습니까? 증가 xmax가 트릭을 수행 한다는 것은 분명 하지만 플롯이 이미 놓일 문서에 비해 너무 커서 다른 접근 방식을 찾고 있습니다. 나는 이미 시도했다 :

  • 글꼴 크기 변경.
  • pmatrixenv가 있는 "열"벡터로 배열합니다 .

그러나 결과는 시각적으로 끔찍합니다. 코드 뒤에 출력 화면 캡을 포함했습니다. 감사!!

\documentclass[tikz]{standalone}

\usepackage{pgfplots}
\pgfplotsset{compat=1.17}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    axis lines=middle,
    axis equal,
    ymax=1.3,
    ymin=-1.3,
    xmax=1.3,
    xmin=-1.3,
    trig format plots=rad,
    declare function = {C(\x)=cos(\x); S(\x)=sin(\x);},
]
    \addplot[domain=-pi:pi,samples=100,red,thick] ({C(x)},{S(x)});
    \addplot[->] coordinates {(0,0) ({C(pi/4)},{S(pi/4)})};
    \addplot[mark=none] coordinates {({C(pi/4)},{S(pi/4)})} node[anchor=south west] {(\cos(\frac{\pi}{4}),\sen(\frac{\pi}{4}))};
\end{axis}  
\end{tikzpicture}
\end{document}

답변

1 PeterGrill Sep 06 2020 at 09:59

옵션을 추가하면 clip=false라벨이 잘리지 않습니다.

메모

  • 나는 -latex이 경우에 더 나은 arrouw를 생산 한다고 생각 하므로 ->.
  • 주어진 MWE $node텍스트 주위에 필수 가 누락되었습니다 .

암호:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
    axis lines=middle,
    axis equal,
    ymax=1.3,
    ymin=-1.3,
    xmax=1.3,
    xmin=-1.3,
    trig format plots=rad,
    declare function = {C(\x)=cos(\x); S(\x)=sin(\x);},
    clip=false
]
    \addplot[domain=-pi:pi,samples=100,red,thick] ({C(x)},{S(x)});
    \addplot[-latex] coordinates {(0,0) ({C(pi/4)},{S(pi/4)})};
    \addplot[mark=none] coordinates {({C(pi/4)},{S(pi/4)})} 
        node[anchor=south west] {$(\cos(\frac{\pi}{4}),\sin(\frac{\pi}{4}))$};
\end{axis}  
\end{tikzpicture}
\end{document}