0

enter image description hereI have the following problem:

I have several pgf plots in one figure (see screenshot). I make it with \subcaptionbox. Now i want to add one legend for all 6 plots, since in all plots the same signals are. It should be placed over the titel "Figure 3.8: Frequency sweep over each path". Can anybody help me how i can do that? I have already seen the thread How to add one single legend entry for several plots? but i would prefer if i don't have to rewrite my whole plots.

\begin{figure}[htbp]
 \centering
  \subcaptionbox{300pF\label{fig:300pF}}
     {\input{sweep_300pF.tex}}
  \subcaptionbox{47pF\label{fig:47pF}}
     {\input{sweep_47pF.tex}}\\[30pt]
  \subcaptionbox{20pF\label{fig:20pF}}
     {\input{sweep_20pF.tex}}
  \subcaptionbox{6.2pF\label{fig:6.2pF}}
     {\input{sweep_6.2pF.tex}}\\[30pt]
  \subcaptionbox{2.7pF\label{fig:2.7pF}}
     {\input{sweep_2.7pF.tex}}
  \subcaptionbox{1.0pF\label{fig:1.0pF}}
     {\input{sweep_1.0pF.tex}}
  \caption{Frequency sweeps over each path}
   \label{fig:single_paths}
 \end{figure} 

here an examplary code for the pgf plots:

\begin{tikzpicture}
   \begin{axis}[
     width=0.475\textwidth, height=6cm,    
     grid = major,
     grid style={dashed, gray!30},
     xmin=0,     % start the diagram at this x-coordinate
     xmax=4,    % end   the diagram at this x-coordinate
     ymin=-3,     % start the diagram at this y-coordinate
     ymax= 3,   % end   the diagram at this y-coordinate
     ytick={-3, -2, -1, 0, 1, 2, 3},
     axis background/.style={fill=white},
     ylabel=Voltage {[}V{]},
     xlabel=Frequency {[}MHz{]},
     tick align=outside]
      \addplot [color = blue]   table[y index = 1]{IMG/sweep_300pF.txt};
      \addplot [color = red]    table[y index = 2]{IMG/sweep_300pF.txt};
      \addplot [color = green]  table[y index =3]{IMG/sweep_300pF.txt};                  
     \end{axis}
   \end{tikzpicture}
Cap
  • 1
  • 2

0 Answers0