我正在尝试使用非常小的数字创建一个图表,我认为我已经成功了。问题是左下角有一个文本覆盖层,我不知道如何删除它。如能提供帮助,我将不胜感激。谢谢!
\documentclass{standalone}
%graph and diagrams
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{automata,positioning}
\pgfplotsset{compat=1.17} %remember this line or the graph wont work
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=\linewidth, height=15cm,
title={$\kappa$ as Determined by Distance and Capacitance},
xlabel={$Distance: \frac{E_0A}{d}_{(10^{-10} \cdot m^{-2}kg^{-1}s^4A^2)} $},
ylabel={$Capacitance: C_{(nF)}$},
label style={font=\small},
xmin=0, xmax=.0000000007,
ymin=0, ymax= 0.0000000016,
xtick={0,.00000000005,...,.0000000007},
ytick ={0.0000000002, 0.0000000004,..., 0.0000000016},
legend pos=north west,
ymajorgrids=true,
grid style=dashed, %remove for undashed grid%
tick label style={font=\scriptsize,
/pgf/number format/.cd, fixed, fixed zerofill},
scaled ticks=true,
yticklabel style={/pgf/number format/precision=1},
xticklabel style={/pgf/number format/precision=1}, ]
%legend
\legend{$1.777x + 2.7 \cdot 10^{-10}$}
%linear line
\addplot [domain=0:.0000000007, samples=100,color=blue] {1.777*x + 0.00000000027};
%data points
\addplot +[only marks, mark=oplus, color=black] coordinates
{(0.0000000000304,0.000000000254) (0.000000000172 ,0.000000001) (0.0000000000369,0.000000000260) (0.0000000000132,0.000000000111) (0.000000000689,0.0000000014)};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
OP 的示例引发了几个错误,其中第一个是
! Package pgfkeys Error: I do not know the key '/pgf/number format/at', to which you passed '(xticklabel cs:0.9,5pt)', and I am going to ignore it. Perhaps you misspelled it.
这是由于/pgf/number format/.cd
使用
tick label style={font=\scriptsize,
/pgf/number format/.cd, fixed, fixed zerofill},
这会将默认路径更改为/pgf/number format
。事实证明,pgfplots
除了传递给 的键之外,还使用了其他键tick label style
,而这些“其他键”要求默认路径不变。
使用/pgf/number format/fixed, /pgf/number format/fixed zerofill
可消除错误以及报告的“奇怪的数字覆盖”。
PS:当编译出现错误时,最好集中精力于第一个错误并在问题描述中提及它。