我想画一条线,其中0
有一个固定的聚集点,\mathbb{R}
点在它附近变厚,并留下一条小痕迹,你可以看到点左边的移动。
点1
是一个始终固定的孤立点。我的图表简单地用马查。我想知道是否可以使用命令完成所有操作\foreach
。
比如下面图片中的点,向左移动,应该会留下一个像彗星一样的小痕迹,以表明这些点都是聚集在上面的0
。
此图片取自网站https://static.oilproject.org/content/13434/puntoaccumulazione.png
我的 MWE 是:
\documentclass[10pt]{article}
\usepackage{tikz}
\begin{document}
\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,300); %set diagram left start at 0, and has height of 300
%Straight Lines [id:da1544303409748331]
\draw (112.5,169) -- (386,167.01) ;
\draw [shift={(388,167)}, rotate = 539.5799999999999] [color={rgb, 255:red, 0; green, 0; blue, 0 } ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ;
%Shape: Circle [id:dp02209809682547026]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (112.5,168.25) .. controls (112.5,164.66) and (115.41,161.75) .. (119,161.75) .. controls (122.59,161.75) and (125.5,164.66) .. (125.5,168.25) .. controls (125.5,171.84) and (122.59,174.75) .. (119,174.75) .. controls (115.41,174.75) and (112.5,171.84) .. (112.5,168.25) -- cycle ;
%Shape: Circle [id:dp22167821914480634]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (131.5,168.25) .. controls (131.5,164.66) and (134.41,161.75) .. (138,161.75) .. controls (141.59,161.75) and (144.5,164.66) .. (144.5,168.25) .. controls (144.5,171.84) and (141.59,174.75) .. (138,174.75) .. controls (134.41,174.75) and (131.5,171.84) .. (131.5,168.25) -- cycle ;
%Shape: Circle [id:dp39173891473190436]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (150.5,168.25) .. controls (150.5,164.66) and (153.41,161.75) .. (157,161.75) .. controls (160.59,161.75) and (163.5,164.66) .. (163.5,168.25) .. controls (163.5,171.84) and (160.59,174.75) .. (157,174.75) .. controls (153.41,174.75) and (150.5,171.84) .. (150.5,168.25) -- cycle ;
%Shape: Circle [id:dp6168290177655962]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (237.25,168) .. controls (237.25,164.41) and (240.16,161.5) .. (243.75,161.5) .. controls (247.34,161.5) and (250.25,164.41) .. (250.25,168) .. controls (250.25,171.59) and (247.34,174.5) .. (243.75,174.5) .. controls (240.16,174.5) and (237.25,171.59) .. (237.25,168) -- cycle ;
% Text Node
\draw (119,148) node [align=left] {A};
% Text Node
\draw (244,147) node [align=left] {B};
\end{tikzpicture}
\end{document}
我的 MWE 的输出是:
答案1
你是想问动画吗?
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\foreach \Y in {1,...,25}
{\begin{tikzpicture}
\draw[thick,-stealth] (-1,0) -- (6,0);
\foreach \X in {1,...,\Y}
{\fill[blue,opacity=\X/\Y] (5/\X,0) circle[radius=2pt];}
\end{tikzpicture}}
\end{document}
此动画是通过运行 pdflatex 然后创建的
convert -density 300 -delay 24 -loop 0 -alpha remove out.pdf ani.gif
在生成的文件上out.pdf
。如果太快或太慢,则增加或减少24
。
这是一个带有标签的版本。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{amssymb}
\begin{document}
\foreach \Y in {1,...,50}
{\begin{tikzpicture}
\draw[thick,-stealth] (-1,0) -- (6,0) node[pos=0.9,above]{$\mathbb{R}$};
\draw[thick,dashed] (-1,0) -- (-2,0);
\fill[blue] (5,0) circle[radius=2pt] node[below]{$1$};
\ifnum\Y>1
\foreach \X in {2,...,\Y}
{\fill[blue,opacity=\X/\Y] (5/\X,0) circle[radius=2pt]
\ifnum\X<7
node[below]{$\frac{1}{\X}$}
\fi
\ifnum\X=7
node[below left,opacity=1]{$\vphantom{\frac{1}{1}}\dots$}
\fi;}
\fi
\fill[red] (0,0) circle[radius=2pt] node[above]{$0$};
\end{tikzpicture}}
\end{document}
答案2
如果我理解正确的话,作为起点,也许可以使用以下代码。
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[>=latex]
\draw [->] (0,0)--(5,0);
\foreach \x [count=\i] in {0,0.5,1,3}{
\node at (\x,0) [draw, circle, fill=black,opacity=0.2*\i, minimum size=1pt](\i){};}
\node at ([yshift=2mm] 1.90) {A};
\node at ([yshift=2mm] 4.90) {B};
\end{tikzpicture}
\end{document}