当我使用 pgfplot 的 smithchart 并将小数点分隔符改为逗号时,x 轴刻度的位置发生了一些奇怪的变化。
一个简单的例子:
\documentclass{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{smithchart}
\pgfplotsset{ every axis label/.append style={font=\scriptsize}, every tick label/.append style={font=\scriptsize}}
\pgfkeys{/pgf/number format/.cd, use comma, set thousands separator={ }}
% THIS IS CAUSING THE PROBLEM
\begin{document}
\begin{figure}[t]
\centering
\begin{tikzpicture}
\begin{smithchart}[scale=1]
\addplot[mark=*, only marks, is smithchart cs] coordinates {
(0.23076923, -0.51282051) (-0.32873098, -0.45626227) (-0.55950021, 0.05655824) (-0.23076923, 0.51282051) (0.32873098, 0.45626227) (0.55950021, -0.05655824) (1,0) (-1,0) (0,0)
};
\addplot[draw=blue,fill=blue, mark=*, only marks, is smithchart cs] coordinates { (0.10750507, -0.12170385)
};
\path[draw=black, dashed] (1,0) circle (1.6cm);
\end{smithchart}
\end{tikzpicture}
\end{figure}
\end{document}
x 轴上的 0.2 和 0.5 高于其他数字。这个问题有解决办法吗?
答案1
为刻度标签添加文本深度:
\documentclass{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{smithchart}
\pgfplotsset{ every axis label/.append style={font=\scriptsize}, every tick label/.append style={font=\scriptsize,text depth=.25ex}} % text depth added
\pgfkeys{/pgf/number format/.cd, use comma, set thousands separator={ }}
\begin{document}
\begin{figure}[t]
\centering
\begin{tikzpicture}
\begin{smithchart}[scale=1]
\addplot[mark=*, only marks, is smithchart cs] coordinates {
(0.23076923, -0.51282051) (-0.32873098, -0.45626227) (-0.55950021, 0.05655824) (-0.23076923, 0.51282051) (0.32873098, 0.45626227) (0.55950021, -0.05655824) (1,0) (-1,0) (0,0)
};
\addplot[draw=blue,fill=blue, mark=*, only marks, is smithchart cs] coordinates { (0.10750507, -0.12170385)
};
\path[draw=black, dashed] (1,0) circle (1.6cm);
\end{smithchart}
\end{tikzpicture}
\end{figure}
\end{document}