Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This is my tikz code to draw some plots.

\documentclass{article}
\usepackage{tikz,subfig}
\begin{document}

\begin{figure}
  \centering
  \subfloat[Iteration Domain for a Tile]{
      \begin{tikzpicture}
        \draw (0,0) rectangle (3.8,3.8);
      \end{tikzpicture}
  }
  \subfloat[Convex Bounding Boxes]{
      \begin{tikzpicture}
        \draw (0,0) rectangle (3.8,3.8);
      \end{tikzpicture}
  }
  \subfloat[Disjoint Bounding Boxes]{
      \begin{tikzpicture}
        \draw (0,0) rectangle (3.8,3.8);
      \end{tikzpicture}
  }
  \caption{Bounding boxes for disjoint union of data regions}
\end{figure}

\end{document}

And this is the output:

enter image description here

I want to draw something like this:

enter image description here

How do I do it?

There are mainly two things:

  1. I want to put legend at the top.
  2. I want to put some description for (a) and some description for both (b) and (c) as shown in above figure.
share|improve this question
    
3  
Please change your LWE (Large Working Example) to a MWE (Minimal Working Example). It will help answerers a lot more. Kind regards –  zeroth Mar 8 '13 at 9:27
    
I have tried and minimized the code. –  tikzlearner Mar 8 '13 at 11:18
1  
Great, however, still your problem seems to be about placement of text above your figures, hence for this you do not need any other things a MWE for your figures could equally be: \begin{tikzpicture}\draw (0,0) rectangle (4,4);\end{tikzpicture}. By using that MWE you can still remove many preamble lines (and also, listings is not used, so that should also be removed). –  zeroth Mar 8 '13 at 11:47
2  
Please see how I would have done your MWE. It doesn't get any (it could, but...) shorter than this. Remember that this will help clarify your problem. –  zeroth Mar 8 '13 at 13:44
show 2 more comments

1 Answer

up vote 2 down vote accepted

Placing the legend on top can be done using the pgfplots package, but the shared title for (b) and (c) is a little hackish (i.e., positioning is manual). I was able to come up with the following.

\documentclass{article}
\usepackage{tikz,subfig}
\usepackage{pgfplots}
\pgfplotsset{width=5cm,compat=newest,every axis legend/.append style={at={(0.5,1.35)}, anchor=south}}
\begin{document}

\begin{figure}
  \centering
  \subfloat[Iteration Domain for a Tile]{
      \begin{tikzpicture}
        \begin{axis}[title=Title]
        \addplot {x};
        \addlegendentry{Legend a}
        \end{axis}
      \end{tikzpicture}
  }
  \subfloat[Convex Bounding Boxes]{
      \begin{tikzpicture}
        \begin{axis}[
        title style={at={(1.17,1)},overlay},
        title=Shared title
        ]
        \addplot [color=red,mark=o]{x^2};
        \addlegendentry{Legend b}
        \end{axis}
      \end{tikzpicture}
  }
  \subfloat[Disjoint Bounding Boxes]{
      \begin{tikzpicture}
        \begin{axis}
        \addplot[color=black,mark=+] {x^3};
        \addlegendentry{Legend c}
        \end{axis}
      \end{tikzpicture}
  }
  \caption{Bounding boxes for disjoint union of data regions}
\end{figure}
\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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