首先,这是我的用于绘制辐射模式的乳胶代码。
\documentclass[10pt,border=10pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[
xticklabel=$\pgfmathprintnumber{\tick}^\circ$,
xtick={0,30,...,330},
ytick={-40,-30,...,0},
ymin=-40, ymax=0,
y coord trafo/.code=\pgfmathparse{#1+40},
rotate=-90,
y coord inv trafo/.code=\pgfmathparse{#1-40},
x dir=reverse,
xticklabel style={anchor=-\tick-90},
yticklabel style={anchor=east, xshift=-4.75cm},
y axis line style={yshift=-4.75cm},
ytick style={yshift=-4.75cm},
legend style={nodes={scale=0.7, transform shape},at={(1,1)},anchor=south west}
]
\legend{On wafer transition, Coaxial connection}
\addplot [no markers, thick, blue] table [x = theta, y=E] {test.txt};
\addplot [no markers, thick, red] table [x = theta, y=E] {coaxial.txt};
\end{polaraxis}
\end{tikzpicture}
\end{document}
它看起来像这样:
我想要实现的目标如下:
在左侧添加 ylabel 并使用 xlabel 作为“-30 -60 -90...”。
文本文件如下:
theta E
-1.8000000e+02 -1.3011849e+01
-1.7900000e+02 -1.3196952e+01
-1.7800000e+02 -1.3434458e+01
-1.7700000e+02 -1.3726597e+01
-1.7600000e+02 -1.4073305e+01
-1.7500000e+02 -1.4473903e+01
-1.7400000e+02 -1.4928467e+01
-1.7300000e+02 -1.5434878e+01
-1.7200000e+02 -1.5988207e+01
-1.7100000e+02 -1.6585284e+01
-1.7000000e+02 -1.7212057e+01
-1.6900000e+02 -1.7854111e+01
-1.6800000e+02 -1.8488690e+01
-1.6700000e+02 -1.9088568e+01
-1.6600000e+02 -1.9615024e+01
-1.6500000e+02 -2.0038881e+01
-1.6400000e+02 -2.0329595e+01
-1.6300000e+02 -2.0478268e+01
-1.6200000e+02 -2.0500797e+01
-1.6100000e+02 -2.0422451e+01
-1.6000000e+02 -2.0283901e+01
-1.5900000e+02 -2.0113727e+01
-1.5800000e+02 -1.9946145e+01
-1.5700000e+02 -1.9806948e+01
-1.5600000e+02 -1.9708116e+01
-1.5500000e+02 -1.9657742e+01
-1.5400000e+02 -1.9664902e+01
-1.5300000e+02 -1.9733524e+01
-1.5200000e+02 -1.9855349e+01
-1.5100000e+02 -2.0027180e+01
-1.5000000e+02 -2.0234596e+01
-1.4900000e+02 -2.0461017e+01
-1.4800000e+02 -2.0678121e+01
-1.4700000e+02 -2.0846971e+01
-1.4600000e+02 -2.0926250e+01
-1.4500000e+02 -2.0875288e+01
-1.4400000e+02 -2.0665921e+01
-1.4300000e+02 -2.0292174e+01
-1.4200000e+02 -1.9773754e+01
-1.4100000e+02 -1.9142243e+01
-1.4000000e+02 -1.8442473e+01
-1.3900000e+02 -1.7707823e+01
-1.3800000e+02 -1.6970389e+01
-1.3700000e+02 -1.6247848e+01
-1.3600000e+02 -1.5554209e+01
-1.3500000e+02 -1.4897275e+01
-1.3400000e+02 -1.4280899e+01
-1.3300000e+02 -1.3704741e+01
-1.3200000e+02 -1.3171972e+01
-1.3100000e+02 -1.2679504e+01
-1.3000000e+02 -1.2226236e+01
-1.2900000e+02 -1.1811134e+01
-1.2800000e+02 -1.1431731e+01
-1.2700000e+02 -1.1086305e+01
-1.2600000e+02 -1.0773273e+01
-1.2500000e+02 -1.0491251e+01
-1.2400000e+02 -1.0238683e+01
-1.2300000e+02 -1.0011628e+01
-1.2200000e+02 -9.8106525e+00
-1.2100000e+02 -9.6327719e+00
-1.2000000e+02 -9.4790233e+00
-1.1900000e+02 -9.3471527e+00
-1.1800000e+02 -9.2353674e+00
-1.1700000e+02 -9.1422434e+00
-1.1600000e+02 -9.0697806e+00
-1.1500000e+02 -9.0139020e+00
-1.1400000e+02 -8.9739878e+00
-1.1300000e+02 -8.9496063e+00
-1.1200000e+02 -8.9374667e+00
-1.1100000e+02 -8.9435322e+00
-1.1000000e+02 -8.9617799e+00
-1.0900000e+02 -8.9892960e+00
-1.0800000e+02 -9.0324484e+00
-1.0700000e+02 -9.0854308e+00
-1.0600000e+02 -9.1486021e+00
-1.0500000e+02 -9.2224034e+00
-1.0400000e+02 -9.3073697e+00
-1.0300000e+02 -9.3973994e+00
-1.0200000e+02 -9.4996713e+00
-1.0100000e+02 -9.6044097e+00
-1.0000000e+02 -9.7189871e+00
-9.9000000e+01 -9.8403988e+00
-9.8000000e+01 -9.9691441e+00
-9.7000000e+01 -1.0097862e+01
-9.6000000e+01 -1.0234596e+01
-9.5000000e+01 -1.0375775e+01
-9.4000000e+01 -1.0515591e+01
-9.3000000e+01 -1.0659158e+01
-9.2000000e+01 -1.0803440e+01
-9.1000000e+01 -1.0947863e+01
-9.0000000e+01 -1.1090781e+01
-8.9000000e+01 -1.1231875e+01
-8.8000000e+01 -1.1368681e+01
-8.7000000e+01 -1.1501177e+01
-8.6000000e+01 -1.1627132e+01
-8.5000000e+01 -1.1745843e+01
-8.4000000e+01 -1.1855411e+01
-8.3000000e+01 -1.1955046e+01
-8.2000000e+01 -1.2043368e+01
-8.1000000e+01 -1.2118997e+01
-8.0000000e+01 -1.2181870e+01
-7.9000000e+01 -1.2229468e+01
-7.8000000e+01 -1.2261927e+01
-7.7000000e+01 -1.2279556e+01
-7.6000000e+01 -1.2280865e+01
-7.5000000e+01 -1.2266491e+01
-7.4000000e+01 -1.2236589e+01
-7.3000000e+01 -1.2191477e+01
-7.2000000e+01 -1.2132258e+01
-7.1000000e+01 -1.2059508e+01
-7.0000000e+01 -1.1973299e+01
-6.9000000e+01 -1.1875633e+01
-6.8000000e+01 -1.1766723e+01
-6.7000000e+01 -1.1648013e+01
-6.6000000e+01 -1.1519811e+01
-6.5000000e+01 -1.1383027e+01
-6.4000000e+01 -1.1238048e+01
-6.3000000e+01 -1.1086305e+01
-6.2000000e+01 -1.0927209e+01
-6.1000000e+01 -1.0761264e+01
-6.0000000e+01 -1.0588111e+01
-5.9000000e+01 -1.0409671e+01
-5.8000000e+01 -1.0222357e+01
-5.7000000e+01 -1.0027180e+01
-5.6000000e+01 -9.8255001e+00
-5.5000000e+01 -9.6150239e+00
-5.4000000e+01 -9.3973994e+00
-5.3000000e+01 -9.1709309e+00
-5.2000000e+01 -8.9374667e+00
-5.1000000e+01 -8.6929366e+00
-5.0000000e+01 -8.4424732e+00
-4.9000000e+01 -8.1826847e+00
-4.8000000e+01 -7.9135557e+00
-4.7000000e+01 -7.6398573e+00
-4.6000000e+01 -7.3591487e+00
-4.5000000e+01 -7.0737281e+00
-4.4000000e+01 -6.7837093e+00
-4.3000000e+01 -6.4910964e+00
-4.2000000e+01 -6.1975650e+00
-4.1000000e+01 -5.9044960e+00
-4.0000000e+01 -5.6130116e+00
-3.9000000e+01 -5.3226926e+00
-3.8000000e+01 -5.0357359e+00
-3.7000000e+01 -4.7549859e+00
-3.6000000e+01 -4.4793287e+00
-3.5000000e+01 -4.2099124e+00
-3.4000000e+01 -3.9485442e+00
-3.3000000e+01 -3.6947605e+00
-3.2000000e+01 -3.4498490e+00
-3.1000000e+01 -3.2139561e+00
-3.0000000e+01 -2.9879076e+00
-2.9000000e+01 -2.7715793e+00
-2.8000000e+01 -2.5641199e+00
-2.7000000e+01 -2.3674556e+00
-2.6000000e+01 -2.1793124e+00
-2.5000000e+01 -2.0014366e+00
-2.4000000e+01 -1.8329210e+00
-2.3000000e+01 -1.6729759e+00
-2.2000000e+01 -1.5214593e+00
-2.1000000e+01 -1.3787713e+00
-2.0000000e+01 -1.2437140e+00
-1.9000000e+01 -1.1162326e+00
-1.8000000e+01 -9.9579318e-01
-1.7000000e+01 -8.8239643e-01
-1.6000000e+01 -7.7604858e-01
-1.5000000e+01 -6.7631155e-01
-1.4000000e+01 -5.8235317e-01
-1.3000000e+01 -4.9558779e-01
-1.2000000e+01 -4.1392685e-01
-1.1000000e+01 -3.3795503e-01
-1.0000000e+01 -2.7152246e-01
-9.0000000e+00 -2.1015152e-01
-8.0000000e+00 -1.5765596e-01
-7.0000000e+00 -1.0975535e-01
-6.0000000e+00 -7.0237835e-02
-5.0000000e+00 -3.8880697e-02
-4.0000000e+00 -1.9396838e-02
-3.0000000e+00 -3.8724433e-03
-2.0000000e+00 0.0000000e+00
-1.0000000e+00 -3.8724433e-03
0.0000000e+00 -1.9396838e-02
1.0000000e+00 -4.2787980e-02
2.0000000e+00 -7.4173445e-02
3.0000000e+00 -1.1770219e-01
4.0000000e+00 -1.6971412e-01
5.0000000e+00 -2.3051229e-01
6.0000000e+00 -3.0046175e-01
7.0000000e+00 -3.7577482e-01
8.0000000e+00 -4.6101691e-01
9.0000000e+00 -5.5323835e-01
1.0000000e+01 -6.5105656e-01
1.1000000e+01 -7.5389065e-01
1.2000000e+01 -8.6110628e-01
1.3000000e+01 -9.7200414e-01
1.4000000e+01 -1.0853112e+00
1.5000000e+01 -1.2001227e+00
1.6000000e+01 -1.3159552e+00
1.7000000e+01 -1.4317314e+00
1.8000000e+01 -1.5473610e+00
1.9000000e+01 -1.6621790e+00
2.0000000e+01 -1.7754521e+00
2.1000000e+01 -1.8875724e+00
2.2000000e+01 -1.9983693e+00
2.3000000e+01 -2.1070340e+00
2.4000000e+01 -2.2152631e+00
2.5000000e+01 -2.3222922e+00
2.6000000e+01 -2.4293162e+00
2.7000000e+01 -2.5369612e+00
2.8000000e+01 -2.6452065e+00
2.9000000e+01 -2.7554889e+00
3.0000000e+01 -2.8671465e+00
3.1000000e+01 -2.9825198e+00
3.2000000e+01 -3.1002516e+00
3.3000000e+01 -3.2228897e+00
3.4000000e+01 -3.3490919e+00
3.5000000e+01 -3.4799338e+00
3.6000000e+01 -3.6166204e+00
3.7000000e+01 -3.7577491e+00
3.8000000e+01 -3.9045695e+00
3.9000000e+01 -4.0565276e+00
4.0000000e+01 -4.2129747e+00
4.1000000e+01 -4.3752689e+00
4.2000000e+01 -4.5427624e+00
4.3000000e+01 -4.7146825e+00
4.4000000e+01 -4.8901080e+00
4.5000000e+01 -5.0704301e+00
4.6000000e+01 -5.2546692e+00
4.7000000e+01 -5.4416482e+00
4.8000000e+01 -5.6313750e+00
4.9000000e+01 -5.8238475e+00
5.0000000e+01 -6.0175044e+00
5.1000000e+01 -6.2121035e+00
5.2000000e+01 -6.4090549e+00
5.3000000e+01 -6.6064955e+00
5.4000000e+01 -6.8040597e+00
5.5000000e+01 -7.0013277e+00
5.6000000e+01 -7.1978207e+00
5.7000000e+01 -7.3929954e+00
5.8000000e+01 -7.5862401e+00
5.9000000e+01 -7.7791907e+00
6.0000000e+01 -7.9689727e+00
6.1000000e+01 -8.1572873e+00
6.2000000e+01 -8.3409104e+00
6.3000000e+01 -8.5216116e+00
6.4000000e+01 -8.6986698e+00
6.5000000e+01 -8.8712986e+00
6.6000000e+01 -9.0386482e+00
6.7000000e+01 -9.1998091e+00
6.8000000e+01 -9.3538187e+00
6.9000000e+01 -9.4996713e+00
7.0000000e+01 -9.6398915e+00
7.1000000e+01 -9.7737538e+00
7.2000000e+01 -9.8967283e+00
7.3000000e+01 -1.0007748e+01
7.4000000e+01 -1.0109755e+01
7.5000000e+01 -1.0202034e+01
7.6000000e+01 -1.0283901e+01
7.7000000e+01 -1.0350525e+01
7.8000000e+01 -1.0409671e+01
7.9000000e+01 -1.0452417e+01
8.0000000e+01 -1.0486919e+01
8.1000000e+01 -1.0508188e+01
8.2000000e+01 -1.0517771e+01
8.3000000e+01 -1.0516463e+01
8.4000000e+01 -1.0505143e+01
8.5000000e+01 -1.0482591e+01
8.6000000e+01 -1.0452417e+01
8.7000000e+01 -1.0418187e+01
8.8000000e+01 -1.0371556e+01
8.9000000e+01 -1.0321251e+01
9.0000000e+01 -1.0267404e+01
9.1000000e+01 -1.0206091e+01
9.2000000e+01 -1.0145631e+01
9.3000000e+01 -1.0082055e+01
9.4000000e+01 -1.0015511e+01
9.5000000e+01 -9.9499700e+00
9.6000000e+01 -9.8891753e+00
9.7000000e+01 -9.8255001e+00
9.8000000e+01 -9.7664115e+00
9.9000000e+01 -9.7117367e+00
1.0000000e+02 -9.6613206e+00
1.0100000e+02 -9.6150239e+00
1.0200000e+02 -9.5762316e+00
1.0300000e+02 -9.5412640e+00
1.0400000e+02 -9.5134913e+00
1.0500000e+02 -9.4927777e+00
1.0600000e+02 -9.4824578e+00
1.0700000e+02 -9.4755915e+00
1.0800000e+02 -9.4790233e+00
1.0900000e+02 -9.4927777e+00
1.1000000e+02 -9.5169532e+00
1.1100000e+02 -9.5482351e+00
1.1200000e+02 -9.5902978e+00
1.1300000e+02 -9.6398915e+00
1.1400000e+02 -9.7008839e+00
1.1500000e+02 -9.7737538e+00
1.1600000e+02 -9.8553487e+00
1.1700000e+02 -9.9499700e+00
1.1800000e+02 -1.0050613e+01
1.1900000e+02 -1.0165691e+01
1.2000000e+02 -1.0288036e+01
1.2100000e+02 -1.0422451e+01
1.2200000e+02 -1.0567330e+01
1.2300000e+02 -1.0720407e+01
1.2400000e+02 -1.0882871e+01
1.2500000e+02 -1.1053128e+01
1.2600000e+02 -1.1231875e+01
1.2700000e+02 -1.1417760e+01
1.2800000e+02 -1.1609714e+01
1.2900000e+02 -1.1808198e+01
1.3000000e+02 -1.2011882e+01
1.3100000e+02 -1.2219778e+01
1.3200000e+02 -1.2431348e+01
1.3300000e+02 -1.2646630e+01
1.3400000e+02 -1.2864151e+01
1.3500000e+02 -1.3085261e+01
1.3600000e+02 -1.3308274e+01
1.3700000e+02 -1.3534617e+01
1.3800000e+02 -1.3764191e+01
1.3900000e+02 -1.3998797e+01
1.4000000e+02 -1.4238579e+01
1.4100000e+02 -1.4485848e+01
1.4200000e+02 -1.4741125e+01
1.4300000e+02 -1.5007443e+01
1.4400000e+02 -1.5285932e+01
1.4500000e+02 -1.5579313e+01
1.4600000e+02 -1.5889448e+01
1.4700000e+02 -1.6215341e+01
1.4800000e+02 -1.6558916e+01
1.4900000e+02 -1.6920580e+01
1.5000000e+02 -1.7294312e+01
1.5100000e+02 -1.7675974e+01
1.5200000e+02 -1.8057157e+01
1.5300000e+02 -1.8420893e+01
1.5400000e+02 -1.8747711e+01
1.5500000e+02 -1.9016988e+01
1.5600000e+02 -1.9196591e+01
1.5700000e+02 -1.9267948e+01
1.5800000e+02 -1.9206253e+01
1.5900000e+02 -1.9016988e+01
1.6000000e+02 -1.8701539e+01
1.6100000e+02 -1.8291006e+01
1.6200000e+02 -1.7809471e+01
1.6300000e+02 -1.7288088e+01
1.6400000e+02 -1.6748782e+01
1.6500000e+02 -1.6212103e+01
1.6600000e+02 -1.5695547e+01
1.6700000e+02 -1.5208193e+01
1.6800000e+02 -1.4756143e+01
1.6900000e+02 -1.4346742e+01
1.7000000e+02 -1.3980368e+01
1.7100000e+02 -1.3661357e+01
1.7200000e+02 -1.3390297e+01
1.7300000e+02 -1.3167956e+01
1.7400000e+02 -1.2994073e+01
1.7500000e+02 -1.2870144e+01
1.7600000e+02 -1.2796564e+01
1.7700000e+02 -1.2773778e+01
1.7800000e+02 -1.2800988e+01
1.7900000e+02 -1.2880650e+01
答案1
您可以在选项中进行计算xticklabel
,以便有条件地设置标签。此外,您还可以放置和移动ylabel
(即是轴)使用y label style={at={(yticklabel cs:0.5)}, xshift=-5.75cm, anchor=east}
左侧的刻度是轴。
\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[
xticklabel={%
\pgfmathparse{(\tick > 180 ? \tick - 360 : \tick)}%
$\pgfmathprintnumber{\pgfmathresult}^\circ$%
},
xtick={0,30,...,330},
ytick={-40,-30,...,0},
ymin=-40, ymax=0,
y coord trafo/.code=\pgfmathparse{#1+40},
rotate=-90,
y coord inv trafo/.code=\pgfmathparse{#1-40},
x dir=reverse,
xticklabel style={anchor=-\tick-90},
yticklabel style={anchor=east, xshift=-4.75cm},
y axis line style={yshift=-4.75cm},
ytick style={yshift=-4.75cm},
ylabel={Gain (dB)},
y label style={at={(yticklabel cs:0.5)}, xshift=-5.75cm, anchor=east},
legend style={nodes={scale=0.7, transform shape}, at={(1,1)}, anchor=south west}
]
\legend{On wafer transition, Coaxial connection}
\addplot [no markers, thick, blue] table [x = theta, y=E] {test.txt};
%\addplot [no markers, thick, red] table [x = theta, y=E] {coaxial.txt};
\end{polaraxis}
\end{tikzpicture}
\end{document}