刻度彼此紧贴,几乎重叠。如何在不改变图表尺寸的情况下将刻度从 $2.5\cdot 10^{-2}$ 更改为仅 $0.025$?
\begin{tikzpicture}
\pgfplotsset{width={.5\textwidth},height={6 cm}}
\begin{axis}[ylabel={$\ln (I/I_0)$},
grid=major,
legend style={ legend pos= north east,},
xtick distance= .025,
]
\addplot[red, mark=square, only marks,]coordinates{
(0., 0.) (0.025, -0.842) (0.05, -1.671) (0.075, -2.217) (0.1, -2.823)};
\legend{$\theta = 11.0^\circ$; $\lambda = 0.77$ pm}
\end{axis}
\end{tikzpicture}
答案1
尝试这个:
\documentclass[border=1mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\pgfplotsset{width={.5\textwidth},height={6 cm}}
\begin{axis}[ylabel={$\ln (I/I_0)$},
grid=major,
legend style={legend pos=north east},
xtick distance=.025,
xticklabel style={/pgf/number format/fixed, /pgf/number format/precision=3}
]
\addplot[red, mark=square, only marks,]coordinates{
(0., 0.) (0.025, -0.842) (0.05, -1.671) (0.075, -2.217) (0.1, -2.823)};
\legend{$\theta = 11.0^\circ$; $\lambda = 0.77$ pm}
\end{axis}
\end{tikzpicture}
\end{document}