Reference: How can a title is placed for a group of pgfplots?,
Pgfplots Manual in 5.7 section grouping plots introduction
Source: When using latex to write a document, usually draw a variety of diagrams, drawing a lot of ways, such as can be painted in Excel, the use of professional drawing software origin, as well as a variety of visual graphics editing tools, these tools have a common feature is the need to draw a good diagram, You need to convert the diagram to PDF format and then reference it in Latex, with the following disadvantages:
- You need to generate a PDF image frequently and crop the image using Acrobat;
- The specifications of the figure, the thickness of the line, the size of the font is difficult to unify;
- Later found that the problem, or the data needs to be modified, then you have to repeat the first step, more time-consuming;
For the pursuit of picture perfection and obsessive compulsive disorder, use pgfplots to solve these problems, because it is based on source code drawing, just modify the code.
Now want to display a group of photos, how to do it?
Workaround:
First introduce third-party libraries
\usepackage{pgfplots}% used for showing all the figure\pgfplotsset{ compat=1.5} \usepgfplotslibrary{groupplots}
Second, you can use Groupplot
\ begin{tikzpicture}\begin{groupplot}[group style={Group Size= 2 by 2},height=3cm,width=3cm]\nextgroupplot[title=one,xlabel={$ X$}]\addplot[blue] table {test.dat};\nextgroupplot[title=two]\addplot coordinates {(0,2) (2,0)};\nextgroupplot[]\addplot coordinates {(0,2) ( 2, 1)};\nextgroupplot[group/empty plot]% shows an empty diagram \ End{groupplot}\node (title) at ($ (group c1r1.center)! 0.5! (group c2r1.center) + (0,2cm) $) {The Title};\ end{tikzpicture}
The effect is as follows:
Latex:pgfplots Multiple graphs grouped display