1

I am looking for a way to make only one xlabel for a matrix of plots with pgfplots. My current plot looks like this enter image description here

and would like a xlabel where the red circle is drawn.

The code for the plot is quite long, but here goes.

\begin{figure}[ht]
\centerfloat
% The VCG 

\subbottom[VCG with no rotation. QRS-axis angle: 30 degrees]{\label{fig:0rotationFrontalVCG}%
    $\vcenter{\hbox{
    \begin{tikzpicture}
    \begin{axis}[
    title = {Frontal VCG},
    axis equal image,
    xlabel= {Right to Left},
    ylabel= {Inferior to Superior},
    ymin = -1000, ymax = 1000,
    xmin = -1000, xmax = 1000,
    ]

    % Plot the VCG
    \addplot[black] table[x = VCGX, y expr = \thisrow{VCGY}*(-1), select coords between index={239}{282}] {data/vcg_analysis_section/frontal_vcg_rotation/30degree.dat}
    [postaction={decorate, decoration={markings,
        mark=between positions 1/15 and 1 step 1/15 with {\arrow[black,line width=1.5pt]{>};}
      }}]
    ;

    % Add the circle
    \draw (axis cs:0,0) circle [black, radius=892.1472];

    % Add the axis through (0,0)
    \addplot[black, -] coordinates {(0, -895) (0, 895)};
    \addplot[black, -] coordinates {(-895, 0) (895, 0)};

    % Add the QRS-axis
    \addplot[red, ->, -triangle 60, line width = 1pt] coordinates {(0, 0) ({cos(-30)*895}, {sin(-30)*895})};

    \end{axis}
    \end{tikzpicture}

    }}$
}
\quad \quad
% The 6 ECG's
\subbottom[Lead I-III plus augmented limb leads shown in cabrera order.]{\label{fig:0rotationFrontalECG}%
$\vcenter{\hbox{
\begin{tikzpicture}

    \pgfplotsset{small}
    \matrix {

        \begin{axis}[title = Lead aVL, width=0.4\textwidth]
            \addplot[black] table[x expr=\coordindex, y=aVL] {data/vcg_analysis_section/frontal_vcg_rotation/30degree.dat};
        \end{axis}
        \pgfmatrixnextcell
        \begin{axis}[title = Lead II, width=0.4\textwidth]
            \addplot[black] table[x expr=\coordindex, y=II] {data/vcg_analysis_section/frontal_vcg_rotation/30degree.dat};
        \end{axis}
        \\
        \begin{axis}[title = Lead I, width=0.4\textwidth,ylabel=Amplitude]]
            \addplot[black] table[x expr=\coordindex, y=I] {data/vcg_analysis_section/frontal_vcg_rotation/30degree.dat};
        \end{axis}
        \pgfmatrixnextcell
        \begin{axis}[title = Lead aVF, width=0.4\textwidth]
            \addplot[black] table[x expr=\coordindex, y=aVF] {data/vcg_analysis_section/frontal_vcg_rotation/30degree.dat};
        \end{axis}
        \\
        \begin{axis}[title = Lead -aVR, width=0.4\textwidth]
            \addplot[black] table[x expr=\coordindex, y expr = \thisrow{aVR}*(-1)] {data/vcg_analysis_section/frontal_vcg_rotation/30degree.dat};
        \end{axis}
        \pgfmatrixnextcell
        \begin{axis}[title = Lead III, width=0.4\textwidth]
            \addplot[black] table[x expr=\coordindex, y=III] {data/vcg_analysis_section/frontal_vcg_rotation/30degree.dat};
        \end{axis}
        \\
    };
\end{tikzpicture}
}}$
}

\caption{Caption for the whole figure}
\label{fig:}
\end{figure}

The label should be placed in the middel of the two last plots.

  • I'm sure you would like using groupplots library of pgfplots. – percusse Dec 1 '14 at 23:09
  • Thank you @percusse that help me a lot to clean up the code and eventually finding the answer – Kasper Sørensen Dec 2 '14 at 10:30
2

Thanks to @percusse I switched to groupplots and then found this Q/A that helped me: Create x and y label which overlaps for multiple plots

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.