4

Suppose I have a table such as

\documentclass[
a4paper
]{scrartcl}

\usepackage{
tgheros,
booktabs
}
\usepackage[T1]{fontenc}

\begin{document}
\begin{center}
\begin{tabular}{lrrrrr}
\toprule
Unit & Thing & Word & More & Things & Letter\\
\toprule
A & 4 & 15 & 10 & 0.4 & 1.5 \\
\midrule
B & 2 & 12 & 7 & 0.29 & 1.71 \\
\midrule
C & 6 & 3\\
\bottomrule
\end{tabular}
\end{center}
    \begin{center}
    \begin{tikzpicture}
        stuff.
    \end{tikzpicture}
\end{center}
\end{document}

Is it possible to feed the last 2 columns as x- and y-values as (data) points to a TikZ figure in the same document? Or maybe even another .tex-file?

In the end, what I would like to do within the tikzpicture-environment would be something like

\node (A) at (x-value-from-above,y-value-from-above) {};
\filldraw (A) circle (0.1cm) node[stylething] {Something};

And all in all, is it maybe automate the procedure? I think what it could lead to would be a giant macro which I could not program anyway. How does anyone else do it? Is it always the pgfplots-table method?

  • That sounds pretty much like a scatterplot. Is that what you're trying to achieve, or do you have something else in mind? – Jake Jun 20 '13 at 21:07
  • Well, if you are referring to this kind of scatterplot, not quite. I amended my op, I hoped I succeeded to clarify the issue? – henry Jun 20 '13 at 21:20
  • 1
    Do you want to keep those tabular row format with ampersands and \\ ? I mean do you need to convert a table data or can it be a foreach macro? pgfplotstable would be quite easier of course. – percusse Jun 20 '13 at 21:24
  • “Even another file” would probably easier to feed as you don’t have \toprule and stuff there, although pgfplotstable could be used to both display the table as well as plot something from it. Besides the x and y value what else from the table should be in the plot. What is stylething, what is Something? Could you make a complete TikZ picture including the actual output from the table? Mind you, the last row is missing some column. By the way, in your example, you could just say \node[stylething, circle, draw] at (<x>,<y>) {Something}; where the node automatically expands. – Qrrbrbirlbel Jun 20 '13 at 21:26
  • 1
    Do you perhaps mean something like Drawing different tikz shapes parameterized by data from a file? – Jake Jun 20 '13 at 21:37

Browse other questions tagged or ask your own question.