How can I get the following figure using Tikz environment please?
[Tex/LaTex] Tikz environment
tikz-pgf
Related Solutions
I am not sure if this is the kind of overlay effect that you are trying to achieve; I used \onslide
so that each image will become visible simultaneously with a corresponding item:
\PassOptionsToPackage{demo}{graphicx}
\documentclass{beamer}
\usepackage{subfigure}
\begin{document}
\begin{frame}
\frametitle{Title}
\begin{minipage}[t]{0.5\linewidth}
\begin{itemize}[<+->]
\item First item.
\item Second item.
\item Third item.
\item Fourth item.
\end{itemize}
\end{minipage}%
\begin{minipage}[t]{0.5\linewidth}
\setcounter{subfigure}{0}
\begin{figure}
\onslide<1->{\subfigure[1]{%
\includegraphics[height=1cm,width=2cm]{scen-q.pdf}
}%
\label{fig:scen1subfig1}}\hfill
\onslide<2->{\subfigure[2]{%
\includegraphics[height=1cm,width=2cm]{scen-b.pdf}
}%
\label{fig:scen1subfig2}}\\
\onslide<3->{\subfigure[3]{%
\includegraphics[height=1cm,width=2cm]{scen-s.pdf}
}%
\label{fig:scen1subfig3}}\hfill
\onslide<4>{\subfigure[4]{%
\includegraphics[height=1cm,width=2cm]{scen-sw.pdf}
}%
\label{fig:scen1subfig4}}%
\caption{test figure}
\label{fig:scencomp}
\end{figure}
\end{minipage}
\end{frame}
\end{document}
Please notice that I included some %
characters that are essential to suppress spurious blank spaces. Also, subfigure
is an obsolete package, so it would be a good idea to use subcaption
instead.
Since I didn't have your actual figures, I used \PassOptionsToPackage{demo}{graphicx}
; this simply replaces actual figures with black rectangles; delete that line in your actual document.
TikZ (or rather pgf
) resets some aspects of the drawing state at the start of a tikzpicture
. This includes the colour and line width, but not the line-joining approach. PDFs do not 'reset' these values automatically when included inside other PDFs, and so the 'child' PDF inherits whatever is set in the 'parent'. As such, if you change the line-joining setting, this will show up in any included PDF that does not explicitly set it. The same would be true for colour or line width in the abstract, but the TikZ reset means that effectively the 'child' is insulated from any change in the 'parent'.
This general point was discussed in https://github.com/pgf-tikz/pgf/issues/870. One could apply
\tikzset{
every picture/.style={%
execute at begin picture={%
\pgfsetbuttcap%
\pgfsetmiterjoin%
\pgfsetmiterlimit{10}%
\pgfsetdash{}{0pt}%
}
}
}
to force appropriate defaults.
Best Answer
An alternative starting point to make own solution. To understand code, I suggest you to read TikZ manual, chapter: "TikZ ist kein Zeichenprogram".