1

The question is perhaps similar to this one Is it possible to make an image gallery with tikz images?; but I do not want to "resize" or "adjust". The two pictures should behave as in both there were the 4 points (+/-1,+/-1). That is the right hand picture should be higher (at the same high as the corresponding points on the left). One way (how?) would be to define two dimensionless invisible points in (1,1) and (-1,-1), so that Tikz assure that the bullets (that extend slightly beyond) are not cut.

enter image description here

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

\begin{document}

\begin{figure}[hbt]
\begin{subfigure}[b]{0.48\textwidth}
\centering
\begin{tikzpicture}[bullet/.style={circle, fill,minimum size=4pt,inner sep=0pt, outer sep=0pt}]
  \node[bullet] at (-1,-1)  (1){};
  \node[bullet] at (1,-1) (2){};
  \node[bullet] at (-1,1) (3){};
  \node[bullet] at (1,1)  (4){};
  \node[bullet] at (0,0)  (0){};
  \draw (0) -- (1);
  \draw (0) -- (2);
  \draw (0) -- (3);
  \draw (0) -- (4);
\end{tikzpicture}
\end{subfigure}
\begin{subfigure}[b]{0.48\textwidth}
\centering
\begin{tikzpicture}[bullet/.style={circle, fill,minimum size=4pt,inner sep=0pt, outer sep=0pt}]
  \node[bullet] at (-1,1) (3){};
  \node[bullet] at (1,1)  (4){};
  \node[bullet] at (0,0)  (0){};
  \draw (0) -- (3);
  \draw (0) -- (4);
\end{tikzpicture}
\end{subfigure}

\caption{caption fig}
\label{fig:label}
\end{figure}

\end{document}
PeptideChain
  • 1,335

1 Answers1

1

One possibility is to define the same bounding box for both figures with for example the command \useasboundingbox (-1,-1)rectangle(1,1);

screenshot

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

\begin{document}

\begin{figure}[hbt]
\begin{subfigure}[b]{0.48\textwidth}
\centering
\begin{tikzpicture}[bullet/.style={circle, fill,minimum size=4pt,inner sep=0pt, outer sep=0pt}]
 \useasboundingbox (-1,-1)rectangle(1,1);
  \node[bullet] at (-1,-1)  (1){};
  \node[bullet] at (1,-1) (2){};
  \node[bullet] at (-1,1) (3){};
  \node[bullet] at (1,1)  (4){};
  \node[bullet] at (0,0)  (0){};
  \draw (0) -- (1);
  \draw (0) -- (2);
  \draw (0) -- (3);
  \draw (0) -- (4);
\end{tikzpicture}
\end{subfigure}
\begin{subfigure}[b]{0.48\textwidth}
\centering
\begin{tikzpicture}[bullet/.style={circle, fill,minimum size=4pt,inner sep=0pt, outer sep=0pt}]
\useasboundingbox (-1,-1)rectangle(1,1);
  \node[bullet] at (-1,1) (3){};
  \node[bullet] at (1,1)  (4){};
  \node[bullet] at (0,0)  (0){};
  \draw (0) -- (3);
  \draw (0) -- (4);
\end{tikzpicture}
\end{subfigure}

\caption{caption fig}
\label{fig:label}
\end{figure}

\end{document}
AndréC
  • 24,137