# Dot grid with increasing dot size

A friend of mine asked me if it would be possible to create a dot grid with increasing dot sizes as shown in the picture (without the icons):

I'm aware that there are tons of tikz-dotgrids to find on the web. But I have no idea of how to increase the dot size.

I think I would need the number of dots per row, the start and the end size of dots and the distance between them. But I have no clue how to combine these parameters to a nice dot grid.

Yes, it is.

\documentclass[border=3.14mm,tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\foreach \X in {1,...,50}
{\foreach \Y in {1,...,50}
\fill (\X*8pt,-\Y*8pt) circle ({(1+0.5*veclen(\X,\Y))*0.1pt});
}
\end{tikzpicture}
\end{document}


EDIT: Just for fun and for J. Leon V. ;-)

\documentclass[border=3.14mm,tikz]{standalone}
\begin{document}
\foreach \Z in {0,30,...,330}
{\begin{tikzpicture}
\clip (0,0) circle (25.5*8pt);
foreach \X in {-25,...,25}
{foreach \Y in {-25,...,25}
{ (\X*8pt,-\Y*8pt) circle ({(1+12*(1.2+sin(\Z+50*veclen(\X,\Y))))*0.1pt})
}
};
\end{tikzpicture}}
\end{document}


• Wow, this is great. – schmendrich Aug 29 '18 at 13:39
• +0, I cant upvote more times for that fast marmot, I hope you can not think of an animation with a spiral that would hurt much more my eyes. – J Leon V. Aug 29 '18 at 20:05
• No problem! I added a fun thing for @JLeonV. instead. ;-) – user121799 Aug 29 '18 at 20:56
• @marmot, I have decrypted the subliminal message of the spiral code ... see the Addendum... – J Leon V. Aug 29 '18 at 23:39

RESULT:

MWE:

\documentclass[border=20pt,tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\foreach \X in {1,...,50}{
\foreach \Y in {1,...,50}{
\fill (\X*10pt,-\Y*10pt) circle ({(\X+\Y+5)*0.05pt});
}
}
\end{tikzpicture}
\end{document}


After some collateral damage I only see marmots everywhere ...

MWE:

\documentclass[border=20pt,tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\foreach \Line [count=\y from 0] in {
{1,1,2,2,1,1,1,1,1,12,53,4,1,2,1,4,5,48,13,1,5,1,4,1,1,1,1,1,1,1},
{1,2,2,1,1,5,3,2,5,81,202,112,42,89,86,36,75,198,128,7,1,4,1,2,1,1,1,1,1,1},
{1,4,2,1,3,1,1,1,6,139,208,188,188,200,209,202,172,201,195,4,1,1,2,1,1,1,1,1,1,1},
{1,1,1,4,2,1,1,2,1,150,179,159,164,171,185,193,214,220,158,1,4,1,1,1,1,1,1,1,1,1},
{4,1,1,2,1,1,4,2,5,121,155,142,140,163,172,188,187,215,152,9,1,1,7,1,1,1,1,1,1,1},
{2,1,3,1,1,3,1,1,85,147,125,140,153,141,152,175,202,196,216,89,4,1,1,2,1,1,1,1,1,1},
{1,1,5,1,2,2,1,25,140,117,107,179,171,119,141,179,212,201,214,190,20,1,5,1,1,1,1,1,1,1},
{1,1,4,1,4,1,8,77,140,106,82,98,104,137,168,159,178,185,199,227,90,2,1,3,1,1,1,1,1,1},
{2,2,1,1,2,1,11,133,124,80,68,63,107,190,235,173,163,183,198,217,172,1,2,2,1,1,1,1,1,1},
{1,2,1,2,4,3,46,148,112,76,47,79,69,144,183,163,183,188,196,216,205,43,2,1,1,1,1,1,1,1},
{1,2,1,2,2,1,89,154,101,67,67,143,95,71,109,171,199,192,195,208,229,98,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,126,150,119,73,60,129,177,178,185,198,187,188,195,203,230,146,2,2,1,1,1,1,1,1},
{2,1,1,2,2,14,156,149,109,94,74,68,106,138,152,154,167,183,199,205,221,186,12,1,1,1,1,1,1,1},
{3,1,1,1,1,33,173,152,126,98,94,95,118,131,146,161,170,190,201,207,215,210,28,1,1,1,1,1,1,1},
{3,1,1,1,1,55,186,169,140,115,109,109,118,122,145,165,176,193,199,209,223,222,42,1,1,1,1,1,1,1},
{2,1,3,1,2,75,201,191,194,146,76,63,63,83,110,141,167,184,196,215,241,229,50,1,1,1,1,1,1,1},
{3,2,1,1,1,96,211,114,150,206,67,23,42,59,88,123,158,165,121,176,236,237,70,1,1,2,1,2,1,2},
{1,1,2,2,4,97,207,149,161,233,114,10,32,47,83,117,146,170,132,173,231,245,83,3,1,3,4,1,1,5},
{2,2,2,1,7,100,214,198,196,246,180,33,46,57,82,115,148,204,196,211,235,240,79,1,1,1,1,5,3,1},
{3,2,1,1,4,96,222,214,232,248,192,50,59,74,97,129,151,213,236,234,231,235,73,5,1,6,1,3,1,1},
{1,1,1,2,1,83,223,199,226,243,167,79,91,100,121,143,158,203,244,233,225,233,60,1,3,1,3,1,2,1},
{1,2,1,3,1,60,220,200,173,181,136,120,126,131,143,158,168,184,212,208,224,229,44,1,1,64,58,2,4,7},
{2,3,1,1,1,30,202,219,185,167,155,159,153,155,162,175,191,192,202,212,236,206,22,19,133,248,59,3,1,3},
{1,2,1,1,2,3,174,226,200,191,182,174,174,174,182,185,191,202,206,218,233,196,90,191,256,148,10,1,1,1},
{1,2,4,1,1,4,99,235,214,204,197,193,193,191,189,200,204,208,217,228,234,216,220,241,146,8,3,2,2,3},
{3,1,1,1,4,1,17,186,231,219,210,202,201,206,208,212,211,221,221,231,231,205,155,67,1,4,1,1,1,1},
{1,5,2,2,4,1,8,34,210,220,229,221,215,220,219,217,219,229,236,219,88,23,5,1,1,1,2,1,1,2},
{1,1,1,1,2,9,1,77,155,186,213,220,229,236,230,229,226,221,229,226,89,1,1,7,1,2,1,1,1,1},
{2,1,5,4,1,1,3,136,222,208,227,256,227,144,143,231,244,227,242,254,143,14,1,1,1,2,1,1,1,1},
{1,3,1,1,8,4,1,3,65,99,115,94,52,7,3,47,92,109,103,57,1,1,10,1,1,1,2,1,1,2}% Yes this percent is suspicious...
}{
\foreach \pixel [count=\x from 0] in \Line {
\ifnum\pixel<20
\fill (\x*10pt,-\y*10pt) circle (20*0.025pt);
\else
\fill (\x*10pt,-\y*10pt) circle (\pixel*0.025pt);
\fi
}
}
\end{tikzpicture}
\end{document}


PSD: To get the marmot icon data I use LCD-Image-converter, then some text manipulation using Excel to get decimal values.

For your friend ;) ... declaring each point as a rectanble 10x10pt sized, controling the black color filling usinsg the values from the data array.

RESULT:

MWE:

% arara: pdflatex: {synctex: yes, action: nonstopmode}
\documentclass[border=20pt,tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\foreach \Line [count=\y from 0] in {
{1,1,2,2,1,1,1,1,1,12,53,4,1,2,1,4,5,48,13,1,5,1,4,1,1,1,1,1,1,1},
{1,2,2,1,1,5,3,2,5,81,202,112,42,89,86,36,75,198,128,7,1,4,1,2,1,1,1,1,1,1},
{1,4,2,1,3,1,1,1,6,139,208,188,188,200,209,202,172,201,195,4,1,1,2,1,1,1,1,1,1,1},
{1,1,1,4,2,1,1,2,1,150,179,159,164,171,185,193,214,220,158,1,4,1,1,1,1,1,1,1,1,1},
{4,1,1,2,1,1,4,2,5,121,155,142,140,163,172,188,187,215,152,9,1,1,7,1,1,1,1,1,1,1},
{2,1,3,1,1,3,1,1,85,147,125,140,153,141,152,175,202,196,216,89,4,1,1,2,1,1,1,1,1,1},
{1,1,5,1,2,2,1,25,140,117,107,179,171,119,141,179,212,201,214,190,20,1,5,1,1,1,1,1,1,1},
{1,1,4,1,4,1,8,77,140,106,82,98,104,137,168,159,178,185,199,227,90,2,1,3,1,1,1,1,1,1},
{2,2,1,1,2,1,11,133,124,80,68,63,107,190,235,173,163,183,198,217,172,1,2,2,1,1,1,1,1,1},
{1,2,1,2,4,3,46,148,112,76,47,79,69,144,183,163,183,188,196,216,205,43,2,1,1,1,1,1,1,1},
{1,2,1,2,2,1,89,154,101,67,67,143,95,71,109,171,199,192,195,208,229,98,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,126,150,119,73,60,129,177,178,185,198,187,188,195,203,230,146,2,2,1,1,1,1,1,1},
{2,1,1,2,2,14,156,149,109,94,74,68,106,138,152,154,167,183,199,205,221,186,12,1,1,1,1,1,1,1},
{3,1,1,1,1,33,173,152,126,98,94,95,118,131,146,161,170,190,201,207,215,210,28,1,1,1,1,1,1,1},
{3,1,1,1,1,55,186,169,140,115,109,109,118,122,145,165,176,193,199,209,223,222,42,1,1,1,1,1,1,1},
{2,1,3,1,2,75,201,191,194,146,76,63,63,83,110,141,167,184,196,215,241,229,50,1,1,1,1,1,1,1},
{3,2,1,1,1,96,211,114,150,206,67,23,42,59,88,123,158,165,121,176,236,237,70,1,1,2,1,2,1,2},
{1,1,2,2,4,97,207,149,161,233,114,10,32,47,83,117,146,170,132,173,231,245,83,3,1,3,4,1,1,5},
{2,2,2,1,7,100,214,198,196,246,180,33,46,57,82,115,148,204,196,211,235,240,79,1,1,1,1,5,3,1},
{3,2,1,1,4,96,222,214,232,248,192,50,59,74,97,129,151,213,236,234,231,235,73,5,1,6,1,3,1,1},
{1,1,1,2,1,83,223,199,226,243,167,79,91,100,121,143,158,203,244,233,225,233,60,1,3,1,3,1,2,1},
{1,2,1,3,1,60,220,200,173,181,136,120,126,131,143,158,168,184,212,208,224,229,44,1,1,64,58,2,4,7},
{2,3,1,1,1,30,202,219,185,167,155,159,153,155,162,175,191,192,202,212,236,206,22,19,133,248,59,3,1,3},
{1,2,1,1,2,3,174,226,200,191,182,174,174,174,182,185,191,202,206,218,233,196,90,191,256,148,10,1,1,1},
{1,2,4,1,1,4,99,235,214,204,197,193,193,191,189,200,204,208,217,228,234,216,220,241,146,8,3,2,2,3},
{3,1,1,1,4,1,17,186,231,219,210,202,201,206,208,212,211,221,221,231,231,205,155,67,1,4,1,1,1,1},
{1,5,2,2,4,1,8,34,210,220,229,221,215,220,219,217,219,229,236,219,88,23,5,1,1,1,2,1,1,2},
{1,1,1,1,2,9,1,77,155,186,213,220,229,236,230,229,226,221,229,226,89,1,1,7,1,2,1,1,1,1},
{2,1,5,4,1,1,3,136,222,208,227,256,227,144,143,231,244,227,242,254,143,14,1,1,1,2,1,1,1,1},
{1,3,1,1,8,4,1,3,65,99,115,94,52,7,3,47,92,109,103,57,1,1,10,1,1,1,2,1,1,2}% Yes this percent is suspicious...
}{
\foreach \pixel [count=\x from 0] in \Line {
\pgfmathparse{int(\pixel/256*100)}
\edef\op{\pgfmathresult}
\ifnum\op<20
\fill[black!10] (\x*10pt,-\y*10pt) rectangle ++(10pt, 10pt);
\else
\fill[black!\op] (\x*10pt,-\y*10pt) rectangle ++(10pt,10pt);
\fi
}
}
\end{tikzpicture}
\end{document}

• Well, I also can't upvote twice. Too bad. Do you have an algorithm for that or do you do it brute force? In the first case I'd be more than happy to ask a question such that you get more reputation points. ;-) – user121799 Aug 29 '18 at 23:42
• As I explain use two other plications, I have worked with LCD screens, so that's where that knowledge comes from, doing it directly in latex would depend on whether there is a command that allows rescaling the image to certain pixels and obtain the color and luminosity values of the pixel, but I do not know, a lot of complication for things that come out when you do them for fun. – J Leon V. Aug 29 '18 at 23:57
• I wish I could upvote again, the marmot is just great! – user36296 Aug 30 '18 at 11:17
• Brilliant. My friend would like to replace the dots with rectangles. But I struggle and get one single black rectangle instead of a rectangle grid :-\ – schmendrich Aug 30 '18 at 19:46
• @schmendrich, done see, addemdum 2... – J Leon V. Aug 31 '18 at 4:54