Two tikZ pictures side by side

  • LaTeX
  • Thread starter member 428835
  • Start date
  • Tags
    Pictures
  • #1

member 428835

Hi PF!

I have been trying to put two tikZ pictures next to each other but I can't figure out how to do it. I've used the \begin{minipage} command, which worked well, but was unable to generate a caption. Any ideas?
 
Physics news on Phys.org
  • #3
robphy said:
First Google entry for: tikz side by side
gives

http://tex.stackexchange.com/questions/213075/two-tikzpictures-side-by-side

Yea, I clicked on the first several google suggestions, but notice the one that you reference has the minipage, and for some reason I can't seem to add a single caption for both pictures underneath. Any suggestions?
 
  • #5
Sure, and I actually just found a way to do it using the subfigure package. Below is a working example:

Code:
\documentclass{article}
\usepackage{tikz}
\usepackage{subcaption} 

\begin{document}
\begin{figure}
    \begin{subfigure}[b]{0.32\textwidth}
        \centering
        \resizebox{\linewidth}{!}{
            \begin{tikzpicture}
                \draw (2,2) circle (3cm);
            \end{tikzpicture}
        }
        \caption{Subfigure A}
        \label{fig:subfig8}
    \end{subfigure}
    \begin{subfigure}[b]{0.32\textwidth}
    \centering
        \resizebox{\linewidth}{!}{
            \begin{tikzpicture}
                \draw (2,2) circle (3cm);
            \end{tikzpicture}
        }
        \caption{Subfigure B}  
        \label{fig:subfig9}
    \end{subfigure}
    \begin{subfigure}[b]{0.32\textwidth}
        \centering
        \resizebox{\linewidth}{!}{
            \begin{tikzpicture}
                \draw (2,2) circle (3cm);
            \end{tikzpicture}
        }
        \caption{Subfigure C}
        \label{fig:subfig10}
    \end{subfigure}
\caption{big caption} 
\label{fig:subfig1.a.4}
\end{figure}

\end{document}
 
  • #6
Actually, while this is not the same question, perhaps you could help? For this line of code

Code:
\draw[domain=0.1:1,samples=100,color=blue,variable=\x] plot (\x,{(\x)^(1/2)});

tikZ is plotting ##y=x^{-1/2}## and when I change the code to

Code:
\draw[domain=0.1:1,samples=100,color=blue,variable=\x] plot (\x,{1/(\x)^(1/2)});

tikZ is plotting ##y=x^{1/2}##. Any idea as to why this is?
 

Suggested for: Two tikZ pictures side by side

Replies
6
Views
843
Replies
3
Views
862
Replies
1
Views
5K
Replies
1
Views
800
Replies
7
Views
718
Replies
5
Views
1K
Replies
1
Views
882
Replies
8
Views
2K
Back
Top