축 및 플롯 스타일에 대한 PGFPlots 키가 부분적으로만 작동함

축 및 플롯 스타일에 대한 PGFPlots 키가 부분적으로만 작동함

3D 곡선의 다양한 뷰를 플롯하려고 하는데 처음부터 축과 플롯 스타일을 정의하고 싶습니다. 나는 이것을 할 수 없었습니다. 코드와 내가 얻는 것은 다음과 같습니다.

\documentclass[tikz,border=2mm]{standalone}

\usepackage{pgfplots}

\begin{document}

    \begin{tikzpicture}[
        declare function ={
            ex(\x)=cos(\x)*sin(2*\x);
            ye(\x)=cos(\x)*cos(2*\x);
            ze(\x)=sin(\x);
        }
    ]
    \pgfplotsset{
        every axis post/.append style={
            trig format plots=rad,
            scale=0.7
        }
        every axis plot/.append style={
            blue,
            domain=0:2*pi,
            samples=120 
        }
    }
    \begin{axis}
    \addplot3 ({ex(x)},{ye(x)},{ze(x)});
    \end{axis}
    \begin{axis}[xshift=7cm, view/h=120,view/v=90]
    \addplot3 ({ex(x)},{ye(x)},{ze(x)});
    \end{axis}
    \end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

내가 원하는 것은 다음과 같습니다(위의 모든 옵션을 모든 axis환경과 모든 \addplot매크로에 작성하여 얻음). 여기에 이미지 설명을 입력하세요

곡선 색상은 적용되지만 나머지 옵션은 적용되지 않습니다. 키에 올바른 구문을 사용하고 있는지 잘 모르겠습니다. 오류 없이 컴파일할 수 있기 때문에 분명히 올바른 구문입니다. 그러나 분명히 내가 원하는 것을 얻기 위한 뭔가가 누락되어 있고 매뉴얼에서 찾을 수 없는 것 같습니다. 미리 감사드립니다!

답변1

pgfplotsset두 부분( every axis post부분과 every axis plot부분) 사이에 쉼표를 잊어버렸습니다 . 또한 일반 설정을 실행하려면 []빈 옵션 세트가 필요합니다 .\addplot3

MWE:

\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}

    \begin{tikzpicture}[
        declare function ={
            ex(\x)=cos(\x)*sin(2*\x);
            ye(\x)=cos(\x)*cos(2*\x);
            ze(\x)=sin(\x);
        }
    ]
    \pgfplotsset{
        every axis post/.append style={
            trig format plots=rad,
            scale=0.7
        },
        every axis plot/.append style={
            purple,
            domain=0:2*pi,
            samples=120 
        }
    }
    \begin{axis}
    \addplot3[] ({ex(x)},{ye(x)},{ze(x)});
    \end{axis}
    \begin{axis}[xshift=7cm, view/h=120,view/v=90]
    \addplot3[] ({ex(x)},{ye(x)},{ze(x)});
    \end{axis}
    \end{tikzpicture}
\end{document}

결과:

여기에 이미지 설명을 입력하세요

관련 정보