
에서 제작된 도형은 \addplot[mesh]
서로 다른 색상을 지닌 선분들로 구성되어 있음을 발견하였다.
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
samples=50,
point meta rel=axis wide,
point meta=y,
]
\addplot[mesh,thick] {sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}
색상 전환이 원활하지 않습니다. 선 색상을 매끄럽게 만들고 싶고 위 코드를 다음과 같이 다시 작성합니다.
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{
compat=newest
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
samples=50,
point meta rel=axis wide,
point meta=y,
colormap access=direct,
shader=interp
]
\addplot[mesh,thick] {sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}
그러면 같은 색상의 라인이 생성됩니다. 포인트 메타에 따라 선 색상이 달라지고 색상 전환이 원활하게 이루어지도록 하려면 어떻게 해야 합니까?
답변1
이건 집에서하지 마 ! (바보니까 ;)
...!)
samples
진지하게, 곡선의 수를 늘려야 합니다 .
출력
코드
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
samples=51,
view={0}{0},
]
\addplot3
[
surf,
line width=2mm,
point meta=z,
shader=interp,
samples y=2,
y domain=0:.05,
]
({x-y*cos(deg(x)},0,{sin(deg(x))+y});
\end{axis}
\end{tikzpicture}
\end{document}