![使用对数刻度轴 PGFPlots 设置小刻度](https://linux22.com/image/394632/%E4%BD%BF%E7%94%A8%E5%AF%B9%E6%95%B0%E5%88%BB%E5%BA%A6%E8%BD%B4%20PGFPlots%20%E8%AE%BE%E7%BD%AE%E5%B0%8F%E5%88%BB%E5%BA%A6.png)
考虑一下这个MWE:
\documentclass[border=5mm]{standalone}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis} [width=15cm,height=10cm,
xmode=log,
xmin=20, xmax=20000,
log ticks with fixed point,
xtick={20,50,100,200,500,1000,5000,10000,20000},
grid=both,
]
\addplot [
domain=20:20000,
samples=100,
]
{x};
\end{axis}
\end{tikzpicture}
\end{document}
我希望 x 轴小刻度出现在
30,40,
60,70,80,90,
300,400,
600,700,800,900
2000,3000,4000,
我怎样才能做到这一点?
答案1
\documentclass[border=5mm]{standalone}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis} [width=15cm,height=10cm,
xmode=log,
xmin=20, xmax=20000,
log ticks with fixed point,
xtick={20,50,100,200,500,1000,5000,10000,20000},
grid=both,
minor xtick={30,40,60,70,80,90,300,400,600,700,800,900,2000,3000,4000},
xminorgrids=false
]
\addplot [
domain=20:20000,
samples=100,
]
{x};
\end{axis}
\end{tikzpicture}
\end{document}