pgfplots에서 어떤 엔터티에 노드를 고정할 수 있나요?

pgfplots에서 어떤 엔터티에 노드를 고정할 수 있나요?

나는부터 읽기가 어렵다고 생각한다.pgfplots 매뉴얼, 참조할 수 있는 엔터티(예: 추가 정보가 있는 앵커 노드).

예를 들어 아래 예에서 참조할 수 있는 일부 또는 전체 엔터티는 무엇입니까?

\documentclass[10pt,border=3mm,tikz]{standalone}
\usepackage{pgfplots}

\begin{document}
 \begin{tikzpicture}
    \begin{axis}[
        title=hello,
        xlabel=x,   
     ]
        \addplot[domain=-1:1]   {(x-.2)^3 + 1};
     
        \addplot[domain=-1:1]   {x+1.5};    
    \end{axis}  
 \end{tikzpicture}
\end{document}

결과

답변1

간단히 말해서 최소한 다음을 참조할 수 있습니다.

  • 엔터티는 다음을 통해 이름을 지정할 수 있습니다.name=
  • current axis같은 사전 정의된 엔터티current plot begincurrent plot end

아래 예를 참조하세요.메모노드의 순서와 배치가 관련될 수 있습니다 current plot .... 예를 들어 예시를 참조하세요.메모노드와 함께 사용되는 다양한 스타일 옵션. 자세한 내용은 에서 찾아보는 것이 좋습니다.pgfplots-수동.

% ~~~ 10.04.2024: Where can I name things like a node? ~~~~~~~~~

\documentclass[10pt,border=3mm,tikz]{standalone}
\usepackage{pgfplots}

\begin{document}
 \begin{tikzpicture}
    \begin{axis}[
        name=AX,                    % <<<
        title=hello,                % not here
        title style={name=TS},      % <<<
        xlabel=x,                   % not here
        xlabel style={name=XL},     % <<<
        ylabel=y,                   % not here
        ylabel style={name=YL},     % <<<
     ]
     \addplot[
        domain=-1:1,
        %name path=CRV, % needs fill between
        %name=AP,       % no
     ]{(x-.2)^3 + 1};
     
     \addplot[domain=-1:1,]{x+1.5};
    
    \end{axis}  
    
    % ~~~ current axis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \node[anchor=west,red,circle,draw]  at (current axis.east)  {CA}; 
    
    % ~~~ current plot ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \node[red,circle,draw]              at (current plot begin) {CPb}; 
    \node[red,circle,draw]              at (current plot end)   {CPe}; 
    
    % ~~~ named axis, see above ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \node[anchor=west,teal]     at (AX.south east)      {AX}; 
    \node[anchor=east,teal]     at (AX.north west)      {AX}; 
    \node[teal]                 at (AX.outer north west){AX}; 
    \node[teal]                 at (AX.origin)          {AXorg}; 
    \node[teal]                 at (AX.center)          {AXcnt}; 
    
    % ~~~ named styles ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \node[anchor=west,purple,draw]  at (TS.east)    {TS}; 
    \node[anchor=west,purple,draw]  at (XL.east)    {XL}; 
    \node[anchor=west,purple,draw]  at (YL.east)    {YL}; 
 \end{tikzpicture}
\end{document}

결과

관련 정보