# How do I make multiple figures in PGFPlotsX and add a table?

Hello!

If I wanted to construct something like this:

As far as for the code I see he is using multiple “\begin{axis}”, but I don’t know if that is possible in PGFPlotsX. I had a look at the gallery here:

https://kristofferc.github.io/PGFPlotsX.jl/stable/examples/gallery.html

I saw the group plot example, but does not seem exactly be what I want.

Kind regards

EDIT: Renamed post to better reflect what I needed

Nevermind, I got it, it was actually the group plot example, one just has to change seperation variables etc.

Leaving it up here, if someone struggles like I did

Kind regards

1 Like

You can find the docs for GroupPlot here:

2 Likes

Thanks, marked yours as solution since it has a link to more documentation!

I really like using it, so far I got this:

Now I am trying to figure out how I put a table / tabular in the upper right corner - will probably open a new question in a while, if I don’t manage to figure it out my self

Kind regards

1 Like

You may be interested in

Thanks! My struggle right now is that I managed to add it using the raw option in the package:

But I cannot figure out how to wrap my table in an axis object… Currently I am making this table as:

[raw"
\pgfplotstabletypeset[
col sep=&,	% specify the column separation character
row sep=\\,	% specify the row separation character
columns/E/.style={string type} % specify the type of data in the designated column
]{
A & B & C & D & E \\
1 & 10 & 0.1 & 1000 & 2011-01-01 \\
2 & 20 & 0.2 & 2000 & 2012-02-02 \\
3 & 30 & 0.3 & 3000 & 2013-03-03 \\
4 & 40 & 0.4 & 4000 & 2014-04-04 \\
5 & 50 & 0.5 & 5000 & 2015-05-05 \\
}
"
]


Will keep digging

Kind regards

A good way of debugging is to look at the latex that is generated and compare it to the one you want.

1 Like

Thanks for the tip! I got it up and running inside TexStudio, will try to se if I can manage to position my table inside the axis element. Currently the generated LaTeX code and result is:

If I remove the table:

So I think I am on the right track, just have a hard time finding out how to position it correctly

Kind regards

Here is my LaTex code for a MWE:

\RequirePackage{luatex85}
\documentclass[tikz]{standalone}
% Default preamble
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\usepgfplotslibrary{polar}
\usepgfplotslibrary{smithchart}
\usepgfplotslibrary{statistics}
\usepgfplotslibrary{dateplot}
% Custom preamble from global variable:
\usepackage{pgfplotstable}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[group style={group size={2 by 2}}, height={4cm}, width={4cm}]
\nextgroupplot[title={1}]
coordinates {
(0,0)
(1,1)
(2,2)
}
;
\nextgroupplot[title={2}]
\pgfplotstabletypeset[
col sep=&,	% specify the column separation character
row sep=\\,	% specify the row separation character
columns/E/.style={string type} % specify the type of data in the designated column
]{
A & B & C & D & E \\
1 & 10 & 0.1 & 1000 & 2011-01-01 \\
2 & 20 & 0.2 & 2000 & 2012-02-02 \\
3 & 30 & 0.3 & 3000 & 2013-03-03 \\
4 & 40 & 0.4 & 4000 & 2014-04-04 \\
5 & 50 & 0.5 & 5000 & 2015-05-05 \\
}

\nextgroupplot[title={3}]
coordinates {
(0,2)
(1,1)
(2,1)
}
;
\nextgroupplot[title={4}]
coordinates {
(0,2)
(1,1)
(1,0)
}
;
\end{groupplot}
\end{tikzpicture}
\end{document}



This produces:

If I out-comment the table generation lines:

Basically I want my table to take the place of the empty axis, “2”.

So I am still stuck - if anyone could get it to work from LaTeX I would be happy to hear how. I have tried the commands / googling what I know, but have not been able to do it. The MWE is a slightly modified version of:

Kind regards

3-4 hours later I got it to work

The trick is to add an empty invisble plot at the location you want your table and then by using:

tp = @pgf TikzPicture()
...
push!(tp,p)
push!(tp,q)
display(tp)


Where p is your GroupPlot and q is the code you are using (based on PGFPlotsTables in my case) in a raw string format

3 Likes