![绘制一系列退入页面的图形;TikZ](https://linux22.com/image/306564/%E7%BB%98%E5%88%B6%E4%B8%80%E7%B3%BB%E5%88%97%E9%80%80%E5%85%A5%E9%A1%B5%E9%9D%A2%E7%9A%84%E5%9B%BE%E5%BD%A2%EF%BC%9BTikZ.png)
我想绘制一个引文网络图表面板,让其逐渐缩进页面,如下图所示。在下面的草图中,每个蓝色矩形代表不同时间点的引文网络,绘制为tikzpicture
。
我尝试适应这是垂直堆栈的示例。交换 x 和 y 命令不会产生正确的效果,因此我认为可能有更好的方法。
答案1
我在这里展示了如何使用一张拼凑起来的tikz
图像(我不知道如何使用tikz
,所以请原谅我的无能)并使用\includegraphics
其余部分。用你的代码替换每个\savestack
。
\documentclass{article}
\usepackage{graphicx,tikz}
\usepackage[usestackEOL]{stackengine}
\def\incg{\includegraphics[width=.5in]{graph.jpg}}
\begin{document}
% REPLACE \incg IN NEXT LINES WITH YOUR `tikz` IMAGES
\savestack\layerA{\fboxsep=0pt\fbox{\colorbox{white}{\tiny%
\begin{tikzpicture}
\node [draw] (A) at (0,0) {demo text};
\node [draw] (B) at (0,-.7) {demo text};
\draw (A.215) -- (B.145);
\draw (A.325) -- (B.35);
\end{tikzpicture}}}}
\savestack\layerB{\incg}
\savestack\layerC{\incg}
\savestack\layerD{\incg}
\savestack\layerE{\incg}
\savestack\layerF{\incg}
\savestack\layerG{\incg}
This sets and staggers the boxes.\\
\fbox{\setstackgap{L}{.06in}\Longunderstack[l]{%
\kern.6in\layerG\\
\kern.5in\layerF\\
\kern.4in\layerE\\
\kern.3in\layerD\\
\kern.2in\layerC\\
\kern.1in\layerB\\
\kern.0in\layerA\\
}}
or this\\
\setbox0=\hbox{
\stackinset{r}{.6in}{t}{.36in}{\layerA}{%
\stackinset{r}{.5in}{t}{.30in}{\layerB}{%
\stackinset{r}{.4in}{t}{.24in}{\layerC}{%
\stackinset{r}{.3in}{t}{.18in}{\layerD}{%
\stackinset{r}{.2in}{t}{.12in}{\layerE}{%
\stackinset{r}{.1in}{t}{.06in}{\layerF}{%
\layerG%
}}}}}}
}\fbox{\kern.6in\raisebox{.36in}{\box0}}
\end{document}
答案2
像这样?
\documentclass{article}
\usepackage{tikz}
\tikzset{
box/.style={%
rectangle,
minimum height=4cm,
minimum width=4cm,
bottom color=blue,top color=blue!50
}
}
\begin{document}
\begin{tikzpicture}
\foreach \x in{4,3,2,1}{
\node[box] (c1) at (\x,\x) {};
}
\end{tikzpicture}
\end{document}
答案3
如果您想要做的只是堆叠一些tikzpicture
s,那么您可以通过简单地使用es 和一些s 来避免嵌套tikzpicture
环境(这可能会产生不良结果或迫使您先前限制内部环境):\raisebox
\hspace
\documentclass{article}
\usepackage{tikz}
\begin{document}
\noindent
\begin{minipage}{\textwidth}
\centering
\begin{tikzpicture}
\draw[fill=orange!30] (0,0) rectangle (2.5,-4);
\end{tikzpicture}%
\hspace*{-30pt}\llap{\raisebox{-0.2\height}[0pt][0pt]{%
\begin{tikzpicture}
\draw[fill=cyan!30] (0,0) rectangle (2.5,-4);
\end{tikzpicture}}}%
\hspace*{-30pt}\llap{\raisebox{-0.4\height}[0pt][0pt]{%
\begin{tikzpicture}
\draw[fill=magenta!30] (0,0) rectangle (2.5,-4);
\end{tikzpicture}}}%
\hspace*{-30pt}\llap{\raisebox{-0.6\height}[0pt][0pt]{%
\begin{tikzpicture}
\draw[fill=olive!30] (0,0) rectangle (2.5,-4);
\end{tikzpicture}}}%
\end{minipage}
\end{document}