# Display a lot of variables in a 2D Diagram

I have a table with values like this:

---------------------------------
| Function | Dimension | Result |
---------------------------------
|     1    |     1     |   15%  |
---------------------------------
|     1    |     2     |   10%  |
---------------------------------
|     1    |     3     |    5%  |
---------------------------------
|     1    |     4     |   10%  |
---------------------------------
|     2    |     1     |   20%  |
---------------------------------
|    ...   |    ...    |   ...  |
---------------------------------
|     24   |     4     |    3%  |
---------------------------------


Funtion = {1,2,3,4,...,24}; Dimension = {1 (dark blue), 2 (light blue), 3 (green), 4 (red)}; Result

You could visualize it like this: I like the fact, that you can compare the dimensions by just looking at the bars.

But I don't like the fact, that you cannot see the result value for a dimension directly.

For Function=1 and Dimension=2, you could think the result is 25%, but it is 10%. So you would need to guess the length, or calculate the difference, on the result axis.

Do you know any other way to visualize all these values in one graph/diagramm/other? I will also like to display 7 dimensions.

It is totally ok if it looks completely different of my diagram. But it shouldn't take too much space on an A4 paper. My diagram uses 3/4 width, and 1/5 of the height of an A4 paper.

## 1 Answer

I would just use groups of (unstacked) bars for this: \documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}

\pgfplotstableread{
Dim F1 F2 F3
1 15 10  5
2 20  5  7
3 10  8  2
4  5 20 10
}\datatable

\begin{document}
\begin{tikzpicture}
\begin{axis}[
ybar=\pgflinewidth,
enlarge x limits=0.25,
yticklabel=\pgfmathprintnumber{\tick}\,\%,
legend entries={Dim 1, Dim 2, Dim 3},
legend pos=outer north east
]
\addplot table [x=Dim, y=F1] {\datatable};
\addplot table [x=Dim, y=F2] {\datatable};
\addplot table [x=Dim, y=F3] {\datatable};
\end{axis}
\end{tikzpicture}
\end{document}

• This looks great! But I also have a diagram with 7 dimensions. So do you think 7 * 24 bars would be too much? :/ Any idea? – Joey Oct 9 '15 at 17:37
• I guess that depends on how large the differences between the data points are, and what kind of comparisons you want to make. If you don't need to make direct comparisons between different dimensions, you could also use 7 plots underneath each other, like in tex.stackexchange.com/a/160588/2552. That might be clearer. – Jake Oct 9 '15 at 17:44