# Draw a line with an isolated and accumulation point in \mathbb{R}

I would like to draw a line where 0 is an fixed accumulation point in \mathbb{R} where the points thicken near it and leave a small trace where you can see the shift to the left of the points.

Point 1 instead is an isolated point always fixed. My graph is simply made with Mathcha. I was wondering if it is possible to do it all with the command \foreach.

For example in the image below the points, move to the left, should leave a small trace like a comet, to show that these points all accumulate on 0.

This image is taken from the site https://static.oilproject.org/content/13434/puntoaccumulazione.png

My MWE is:

\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}


The output of my MWE is:

Are you asking for an animation?

\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}
\end{tikzpicture}}
\end{document}


This animation is created by running pdflatex and then

 convert -density 300 -delay 24 -loop 0 -alpha remove out.pdf ani.gif


on the generated file out.pdf. If it is too fast or slow, increase or decrease 24.

And this is a version with labels.

\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}
\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}


• I love the output! Question: does opacity=\X/\Y mean the quantity \X divided by the quantity \Y, and the result (which is less or equal than 1) is storaged on opacity? Thanks! – manooooh Jun 8 at 0:26
• @manooooh Yes, that is correct. The idea is that the older points fade away, and the newest one has full opacity. Very likely there are better formulae, but this one is at least simple. ;-) – user121799 Jun 8 at 0:34
• @marmot Write me the clarifications you want so I can answer you. The graph is useful for me for the new state exams in Italian. – Sebastiano Jun 8 at 15:42
• @Sebastiano Better now? – user121799 Jun 8 at 16:08
• @marmot Perfect!!!!! – Sebastiano Jun 8 at 16:10

If I understood right you, for a starting point, following code maybe use.

\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}


• Unfortunately I use the translator and the dots move to the left leaving a trace to the left like a comet. i appreciated your code. – Sebastiano Jun 7 at 21:31