我得到了这个数字:
\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{axis}[width=200pt,axis x line=middle, axis y line=center, ylabel={$\frac{{\delta x}_j}{{\Delta x}_j}$},xlabel={$n$},xmin=0,xmax=6,ymin=0,ymax=1.5]
\addplot+[mark=none,smooth] (\x,{1/(2^(\x))});
\end{axis}
\end{tikzpicture}
\caption{Effect of the parameter $n$ on the particle nodes scaling}
\label{n_influence}
\end{figure}
问题是我不想绘制此函数的实数部分,但我想绘制它的整数部分。有人有解决方案吗?
答案1
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{axis}[width=200pt,axis x line=middle, axis y line=center,
ylabel={$\frac{{\delta x}_j}{{\Delta x}_j}$},
xlabel={$n$},xtick={0,1,2,3,4,5,6},xmin=0,xmax=7,ymin=0,ymax=1.5]
\addplot+[only marks,domain=0:6,samples=7] (\x,{1/(2^(\x))});
\end{axis}
\end{tikzpicture}
\caption{Effect of the parameter $n$ on the particle nodes scaling}
\label{n_influence}
\end{figure}
\end{document}