tikz 극좌표의 점 색상 변경

tikz 극좌표의 점 색상 변경

현재 극좌표에서 단일 점의 색상을 변경하는 데 어려움을 겪고 있습니다. 원통을 사용하여 HSV 색상 공간에 대한 시각화를 만들고 싶습니다.

덕분에pgfplots에서 원뿔의 HSV 음영 처리point meta={symbolic={Hsb=v,u,u}}현재 좌표에서 직접 올바른 색상을 얻는 데 사용할 수 있다는 것을 배웠습니다 .

하지만 실린더로 바꾸면 많은 것을 얻게 됩니다.

Missing number, treated as zero.
<to be read again> 
LaTeX
Illegal unit of measure (pt inserted).
<to be read again> 
LaTeX

오류.

내 현재 코드는 다음과 같습니다

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

\begin{document} 
\begin{axis}[axis equal, data cs=polar]
    
    \addplot3 [surf,
                domain=0:1,
                y domain=0:180,
               samples=20, %number of samples taken
               z buffer=sort,
               shader=interp,
               variable=\u,
               variable y=\v,
               point meta={symbolic={Hsb=u,v,v}}] % the origin of my errors
        (
            {v/2},
            {sin(v/2)},
            {u}
        );
    
    \end{axis}
\end{document}

나는 실린더를 생성하는 나의 해학적 방법이 문제를 일으킬 수 있다고 생각하지만 그것에 대해 머리를 감쌀 수는 없습니다.

미리 감사드립니다

답변1

MWE를 포함하도록 수정하신 것을 확인했습니다 mesh/color input = explicit mathparse,! 후손의 경우 \v[0,180]을 전달하는 [0,1]의 값이 필요한 포화용 HSB "S"에도 문제가 있었습니다 .

재미삼아 전체 실린더를 원할 경우 도메인을 변경할 수 있습니다.

\documentclass[tikz,border=3mm]{standalone} 
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document} 
\begin{tikzpicture}
    \begin{axis}[axis equal, data cs=polar]
    \addplot3 [
        surf,
        domain = 0:1,
        y domain = 0:360,
        samples = 20, %number of samples taken
        z buffer = sort,
        shader = interp,
        variable = \u, variable y = \v,
        mesh/color input = explicit mathparse,
        point meta={symbolic={Hsb=v,1,u}},
        ] 
        ({v/2},{sin(v/2)},{u});
    \end{axis}    
\end{tikzpicture}
\end{document}

HSB 착색이 적용된 개방형 실린더 풀 컬러 스펙트럼을 갖춘 반원통형을 원한다면 Hue를 두 배로 늘리면 됩니다.

\documentclass[tikz,border=3mm]{standalone} 
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document} 
\begin{tikzpicture}
    \begin{axis}[axis equal, data cs=polar]
    \addplot3 [
        surf,
        domain = 0:1,
        y domain = 0:180,
        samples = 20, %number of samples taken
        z buffer = sort,
        shader = interp,
        variable = \u, variable y = \v,
        mesh/color input = explicit mathparse,
        point meta={symbolic={Hsb=2*v,1,u}},
        ] 
        ({v/2},{sin(v/2)},{u});
    \end{axis}    
\end{tikzpicture}
\end{document}

HSB 컬러링이 적용된 상단 개방형 하프 실린더

답변2

나는 코드를 다시 보았다.pgfplots에서 원뿔의 HSV 음영 처리그리고 내가 mesh/color input=explicit mathparse축 옵션을 추가하지 못한 것을 발견했습니다.

작업 코드는 다음과 같습니다

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

\begin{document} 
\begin{tikzpicture}

    \begin{axis}[axis equal, data cs=polar, mesh/color input=explicit mathparse] % the solution to my problem
    
    \addplot3 [surf,
                domain=0:1,
                y domain=0:180,
               samples=20, %number of samples taken
               z buffer=sort,
               shader=interp,
               variable=\u,
               variable y=\v,
               point meta={symbolic={Hsb=v,1,u}}]
        (
            {v/2},
            {sin(v/2)},
            {u}
        );
    
    \end{axis}
    
\end{tikzpicture}
\end{document}

컴파일된이미지

관련 정보