So I am trying something: I want to have a loop reading out the position of circles from a dat file. The plotting already works very well. However now I want to implement a gradual shading from semi to totally transparent. The semi transparent part in the middle i want to be able to set the opacity of. Using a predefined value in a .dat file.
I found these both links. However the way I am drawing does not really allow the functions of the second link.
TikZ: radial shading of a ring
Is it possible to make a gradient from 'opaque color' to 'total transparency'?

Is there a way to accompany for this without loosing transparency?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usepackage{forloop}
\usepackage{pgfplotstable}
\usepackage{readarray}
\usepackage{ifthen}
\usepackage[left=4cm, right=10cm, top=2cm]{geometry}
\usepackage{filecontents}
\begin{filecontents*}{mydata.dat}
name test .dat
opacity: 10 percent
X Y Rad
0 0 0.75
0 1.8 0.75
0 3.6 0.75
0 5.4 0.75
0.75 0 0.75
0.75 1.8 0.75
0.75 3.6 0.75
0.75 5.4 0.75
1.5 0 0.75
1.5 1.8 0.75
1.5 3.6 0.75
1.5 5.4 0.75
2.25 0 0.75
2.25 1.8 0.75
2.25 3.6 0.75
2.25 5.4 0.75
3 0 0.75
3 1.8 0.75
3 3.6 0.75
3 5.4 0.75
3.75 0 0.75
3.75 1.8 0.75
3.75 3.6 0.75
3.75 5.4 0.75
4.5 0 0.75
4.5 1.8 0.75
4.5 3.6 0.75
4.5 5.4 0.75
5.25 0 0.75
5.25 1.8 0.75
5.25 3.6 0.75
5.25 5.4 0.75
6 0 0.75
6 1.8 0.75
6 3.6 0.75
6 5.4 0.75
\end{filecontents*}
\pgfplotsset{compat=1.16}
\begin{document}
\xdef \name {test.dat} %%
\readdef{\name}{\data}
\readarray\data\MyDat[-,39, 3]
\section*{\MyDat[1,1,2] }
\centering
\begin{tikzpicture}[square/.style={regular polygon,regular polygon sides=4}]
\def \opacity {\MyDat[1,2,2]/10*0.15}
\foreach \row in {4,...,39}{
\def\x{\MyDat[1,\row,1]}
\def\y{\MyDat[1,\row,2]}
\def\radius{\MyDat[1,\row,3]}
%\fill[red,opacity= \opacity] (\x,\y)circle(\radius cm);
%%%% This does not work:
\fill[even odd rule, inner color= red, outer color= red!5, ,opacity= \opacity,] (\x,\y)circle(\radius cm);
}
\end{tikzpicture}
\end{document}


\def \lineopacity {\MyDat[1,2,2]/12.7*0}once and for all. How will there be a gradient? – Jul 04 '19 at 14:22