
그래서 나는 시뮬레이션 프로그램에서 내보낸 데이터로 생성된 안테나의 방사 패턴을 설명하는 3D 극좌표를 가지고 있습니다. 중앙의 스파이크는 방사 패턴의 주요 특징이지만 더 많아야 합니다.둥근.
이는 최대 각도 분해능이 3도(x 및 y축의 단위는 각도)이기 때문에 발생합니다. 해상도가 더 작으면(2도 또는 1도) TeX capacity exceeded
오류가 발생합니다.
하지만 피크 부근(-15 < phi, theta < 15)에서만 해상도를 향상시킬 수 있으면 좋겠지만 데이터 파일 때문에 어려움을 겪고 있습니다.
MWE는 다음과 같습니다.
\documentclass{standalone}
\usepackage{pgfplots,siunitx}
\usepgfplotslibrary{dateplot,polar,units,external}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
colorbar,
data cs=polar,
ymin=-50, ymax=50,
xmin=-50, xmax=50,
zmin=0, zmax=31,
xlabel={$\phi$},
x unit=\si{\degree},
ylabel={$\theta$},
y unit=\si{\degree},
zlabel={Directivity},
z unit=\si{\dB},
point meta min=0, point meta max=31,
unit vector ratio*=1 1 2,
z buffer=sort,
view={45}{30},
width=20cm
]
\addplot3[surf, fill=white, mesh/ordering=y varies, mesh/rows=61] %
table[x index={1},y index={0},z index={2}]{8x8-ful-arr-good-3.txt};
\end{axis}
\end{tikzpicture}
\end{document}
데이터 파일은 다음과 같습니다.
pgfplots를 사용하여 원하는 영역의 플롯을 개선하는 방법을 찾고 있습니다. 두 파일을 합칠 수 있는 방법이 있나요?
답변1
x filter
및/또는 을 사용하여 필요하지 않은 점을 필터링할 수 있습니다 y filter
. 메쉬 구조를 그대로 유지하려면 다음 두 가지 항목을 존중해야 합니다.
- 할당했는지 확인하세요
unbounded coords=jump
- 폐기해야 할 포인트가 "nan"을 수신하는지 확인하십시오(그리고~ 아니다빈 값).
이러한 항목 중 하나라도 위반하면 메시 구조가 파괴됩니다.
내가 얻는 것은 다음과 같습니다.
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
data cs=polar,
% ymin=-180, ymax=180,
% xmin=-180, xmax=180,
% zmin=-20, zmax=11,
% unit vector ratio*=1 1 10,
z buffer=sort,
view={45}{30},
width=15cm,
x filter/.code={%
% PHI:
\ifdim-15pt>#1pt
\def\pgfmathresult{nan}%
\fi
},
y filter/.code={%
% THETA
\ifdim#1pt>15pt
\def\pgfmathresult{nan}%
\fi
},
unbounded coords=jump,
]
\addplot3[surf, fill=white, mesh/ordering=y varies, mesh/rows=37] table[x index={1},y index={0},z index={2}]{polar.dat};
\end{axis}
\end{tikzpicture}
\end{document}
몇 가지 참고사항:
- 나는 당신의 데이터 파일을 사용했습니다Pgfplots는 극좌표의 경로를 닫습니다..
- 효과
x filter
가 없는 것 같습니다. 데이터 파일을 기반으로 해당 항목을 조정하고 싶을 수도 있습니다. - 내 예제의 필터는 TeX 기본 형식, 즉
\ifdim<dimension1> <operation> <dimension2>
. 이 문맥의 숫자에는 차원이 없으므로 인위적으로 "pt"를 추가해야 합니다. 이 접근 방식은 정확도와 숫자 범위가 16384 미만으로 제한되어 있지만 이 그림에서는 작동합니다. \if<condition> \else \fi
조건문에 대한 TeX 기본 요소이며\def\pgfmathresult{nan}
결과를 "nan"으로 덮어씁니다.- 일부 슬라이스에 구멍이 있고 "(-15 < phi, theta < 15)" 조건을 수정해야 할 수도 있습니다. 잘못된 데이터 파일을 사용했거나 실제로 다른 인수가 필요하기 때문입니다.
참고 자료: pgfplots 매뉴얼, 특히 unbounded coords
.