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?

David Carlisle
  • 757,742
henry
  • 6,594
  • 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
  • @percusse Well I am preparing the tables in Calc/Excel and exporting them via the 2 relevant tools... but the thing is, I favor the amount of little option with TikZ as I see pgfplots as a macro package on top of that and ran into just too many desperate situation 1-2 years back. But I guess I could use both packages in a doc. – henry Jun 21 '13 at 07:42
  • @Qrrbrbirlbel Those were, of course, arbitrary style options or sth. similar. Also, not always is data complete. I probably could have indicated that as the 4th and 5th columns were ratios of the 1st&3rd and 2nd&3rd, this row is incomplete. About the your code suggestion, the node naming was omitted. – henry Jun 21 '13 at 07:50
  • @Jake Actually your comment turned out to be the one that helped me the most. Thanks. – henry Jul 03 '13 at 13:35

0 Answers0