我想生成一个好的图形来显示序列极限的视觉定义。到目前为止,这只是一个想法,但我想对其进行改进,例如:
我怎样才能删除 $x$ 和 $y$ 轴上的粗线?我指的是数字。$\ell \pm \epsilon$ 没问题。
我怎样才能使 $x$ 轴更长,以获得更大的数字?
谢谢!这是代码,带有序言。
\documentclass[a4paper, 14pt]{extarticle}
\usepackage{geometry}
\geometry{total={173mm, 257mm}, left=23mm, top=23mm, right=23mm, bottom=23mm}
\usepackage{amsmath}
\usepackage[bb=stixtwo]{mathalpha}
\usepackage{concmath}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary {datavisualization.formats.functions}
\usetikzlibrary{calc,matrix}
\usepackage{arydshln}
\usepackage{pspicture}
\usepackage{physics}
\usepackage{mathtools}
\usetikzlibrary{fit}
\newcommand{\tikznode}[2]{\relax
\ifmmode%
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};
\else
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
\fi}
\tikzset{box around/.style={
draw,rounded corners,
inner sep=2pt,outer sep=0pt,
node contents={},fit=#1
},
}
\begin{center}
\begin{tikzpicture}
\begin{axis}[black, thick,
ymin = 0,
ymax = 3,
xmin = 0,
xmax = 19,
axis x line=center,
axis y line=left]
\addplot[samples at={0,...,16},only marks,mark size=1, blue]{(2*x+1)/(x+2)};
\end{axis}
\draw[->, thick, black] (0, 0) -- (6.85, 0)
node[right] {$n$};
\draw[thick, dashed] (0, 3.3) -- (6, 3.3);
\draw[thick, dashed] (0, 4.3) -- (6, 4.3);
\draw[thick, dotted] (0, 3.8) -- (6, 3.8);
\coordinate (A) at (0, 3.3);
\draw (A) node[left] {$\ell - \epsilon$} node {};
\coordinate (B) at (0, 4.3);
\draw (B) node[left] {$\ell + \epsilon$} node {};
\draw[->, thick, black] (0, 0) -- (0, 5.7)
node[above] {$a_n$};
\end{tikzpicture}
\end{center}
答案1
像这样:
代码(我没有重新审视你的序言):
\documentclass[a4paper, 14pt]{extarticle}
\usepackage{geometry}
\geometry{total={173mm, 257mm}, left=23mm, top=23mm, right=23mm, bottom=23mm}
\usepackage{amsmath}
\usepackage[bb=stixtwo]{mathalpha}
\usepackage{concmath}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary {datavisualization.formats.functions}
\usetikzlibrary{calc,matrix}
\usepackage{arydshln}
\usepackage{pspicture}
\usepackage{physics}
\usepackage{mathtools}
\usetikzlibrary{fit}
\newcommand{\tikznode}[2]{\relax
\ifmmode%
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};
\else
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
\fi}
\tikzset{box around/.style={
draw,rounded corners,
inner sep=2pt,outer sep=0pt,
node contents={},fit=#1
},
}
\begin{document}
\begin{center}
\begin{tikzpicture}
\begin{axis}[black, thick,
ymin = 0,
ymax = 3,
xmin = 0,
xmax = 25,
axis x line=center,
axis y line=left,
hide x axis,
hide y axis]
\addplot[samples at={0,...,23},only marks,mark size=1, blue]{(2*x+1)/(x+2)};
\end{axis}
\draw[->, black] (0, 0) -- (6.85, 0)
node[right] {$n$};
\draw[thick, dashed] (0, 3.3) -- (6.5, 3.3);
\draw[thick, dashed] (0, 4.3) -- (6.5, 4.3);
\draw[thick, dotted] (0, 3.8) -- (6.5, 3.8);
\coordinate (A) at (0, 3.3);
\draw (A) node[left] {$\ell - \epsilon$} node {};
\coordinate (B) at (0, 4.3);
\draw (0,3.8) node[left] () {$\ell$};
\draw (B) node[left] {$\ell + \epsilon$} node {};
\draw[->, thick, black] (0, 0) -- (0, 5.7)
node[above] {$a_n$};
\end{tikzpicture}
\end{center}
\end{document}
编辑:更简单的解决方案仅使用tikz
。代码:
\documentclass[tikz,border=.5cm]{standalone}
\begin{document}
\begin{tikzpicture}[scale=2]
\draw[-latex] (-.5,0) -- (5.1,0) node[right] {$n$};
\draw[-latex] (0,-.5) -- (0,3.1) node[above] {$a_n$};
\node at (-.2,-.2) (o) {$O$};
\draw[thin,dashed] (5,2.3)--(0,2.3) node[left] () {$\ell+\epsilon$};
\draw[thick,dashed] (5,2)--(0,2) node[left] () {$\ell$};
\draw[thin,dashed] (5,1.7)--(0,1.7) node[left] () {$\ell-\epsilon$};
\foreach \x in {0,...,30}
\fill[blue] ({\x/6},{(2*\x+1)/(\x+2)}) circle(1pt);
\end{tikzpicture}
\end{document}
输出: