I'm trying to create a series of figures in the below format, and would like to see if there's a way to do this in latex instead of my current fiddly and time consuming method, which uses an external graphing program to create a pdf image that I simply load in to my latex document using a graphics package.


The central graph is a simple jpg, while the rest of the data used is in a dat file. All horizontal axes have the same values and dimensions, and likewise all vertical axes have the same values and dimensions.

Is it possible for latex to plot all this together in a format that matches the shown figure?

  • Yes. pgfplots should be able to handle that easily. The groupplots library (part of pgfplots) might be useful. – Torbjørn T. Nov 2 '16 at 18:38
  • 1
    @Werner could you please delete the image you added. By uploading my image in that manner stackexchange puts a creative commons licence on it, which I didn't want to do to my data, hence why I uploaded it offsite. – Ulysses Nov 2 '16 at 18:45
  • 1
    I know this is off-topic, but doesn't uploading to imgur give them lots of license too? (TOS) – Matthew Leingang Nov 2 '16 at 19:23
  • 1
    @Ulysses: Furthermore, I'm assuming you want to remove this image once you're satisfied that your question is answered. At that point, this question becomes useless (despite the current answer), because no-one would be able to view the output you want and with a title requesting to "recreate this image", it doesn't provide any value to future visitors. If this is the case, your question will most likely be subject to closure as being "unclear what is being asked". – Werner Nov 2 '16 at 19:30
  • 1
    @Ulysses: See Delete uploaded image. – Werner Nov 2 '16 at 19:46

Proof of concept.

enter image description here


x y
0 1
2 1
3 3
4 5
5 2
6 1.5
7 1
8 0
 group style={
   group size=2 by 2,
   vertical sep=0pt,
   horizontal sep=0pt

   xtick pos=right,
\addplot graphics[xmin=0,xmax=8,ymin=0,ymax=8] {example-image-1x1};

  x post scale=-1,
  ytick pos=right,

\addplot table[x=y,y=x] {data.dat};

\addplot table[x=x,y=y] {data.dat};

\nextgroupplot[group/empty plot]

  • Thanks so much! This should be enough to get me started. I'll give this a go and see if I can get everything working. :D – Ulysses Nov 2 '16 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.