I would like to change the content of my pgf table column "Image" from using an included graphic to a predefined TikZ \pic based on the information in column "Type". The \pic should be centered horizontally and vertically inside of the table.
Here is my working MWE
\documentclass{article}
\usepackage[a4paper, margin=10mm]{geometry}
\usepackage{pgfplotstable}
\usepackage{mwe}
\pgfplotsset{compat=newest}
\begin{filecontents}{data.csv}
Image, ID, Description, Type, X-Pos, Y-Pos, rotation
powerSupply, A1F5F, PowerSupply1, PowerSupply, 3590, 2000, 270
powerSupply, 7ZF3I, PowerSupply2, PowerSupply, 3590, 2500, 270
powerSupply, O7PYQ, PowerSupply3, PowerSupply, 4250, 6070, 180
powerSupply, A7HAZ, Switch1, singleSwitch,5700, 6070, 180
\end{filecontents}
\pgfplotstableread[col sep=comma]{data.csv}{\csvdata}
\pgfplotstablegetrowsof{\csvdata}
\pgfmathtruncatemacro\CSVDataRows{\pgfplotsretval-1}
\begin{document}
\begin{center}
\pgfplotstabletypeset[%
font=\ttfamily,%
col sep=comma,%
columns={Image, ID, Description, Type, X-Pos, Y-Pos},%
columns/Image/.style={%
column name=Image,%
assign cell content/.code={%
\pgfkeyssetvalue{/pgfplots/table/@cell content}{\includegraphics[scale=0.07]{example-image}}} %==> This should be changed to add a TikZ \pic depending on the type column!
},%
columns/ID/.style={%
column name=ID,%
string type%
},%
columns/Description/.style={%
column name=Description,%
string type%
},%
columns/Type/.style={%
column name=Type,%
string type%
},%
columns/X-Pos/.style={%
column name=X-Pos%
},%
columns/Y-Pos/.style={%
column name=Y-Pos,%
column type/.add={}{|}%
},%
column type/.add={|}{},%
after row={\hline},%
every head row/.style={before row=\hline},
]{\csvdata}%
\end{center}
\end{document}
For Example we could use these two mini TikZ
%PowerOutlet
\tikzset{
pics/stove/.style={
code={
\begin{scope}[scale=\resultImageScale]
\draw[red,line width=\resultLineScaleMetric](0,0)--(0,1);
\draw[red,line width=\resultLineScaleMetric](-1,1)--(1,1);
\draw[red,line width=\resultLineScaleMetric,line cap=round](-1,2) arc[start angle=180,end angle=360,radius=1] node[midway,above,sloped,font=\bfseries] {\scalebox{\scaleRatio}{1}};
\end{scope}
}
}
}
%Button
\tikzset{
pics/stove/.style={
code={
\begin{scope}[scale=\resultImageScale]
\drawred,line width=\resultLineScaleMetric circle[radius=1];
\drawred,line width=\resultLineScaleMetric circle[radius=0.6];
\end{scope}
}
}
}

\cincludegraphics[scale=0.07]{../Images/ElectricComponents/##1.png}}(why\cincludegraphicsby the way?) to something like\tikz{ \pic {button}; }. Your follow-up question can only be answered if you provide a full MWE, because currently there are parts in the code of which the defintion is unclear. – Jasper Habicht Feb 26 '24 at 15:14\pic's for the answer example :) – PascalS Feb 26 '24 at 18:03