一张图片连接多个地块

一张图片连接多个地块

我想用 TikZ/pgfplots 创建类似这张图片的东西(在 PowerPoint 中完成)。如果有人知道一个可以给我启发的例子,我会非常高兴!

多谢!

图形绘制

答案1

我的大部分答案都是为这个特定的 MWE 设置的,因为 OP 没有提供可以叠加的图表……我不得不自己创建。

在花费了大部分代码构建绿色、蓝色和红色的图形作为占位符(它们可以是其他东西tikz)之后,我使用\stackinset它们相互放置并叠加一些橙色虚线。

这是 MWE。查看末尾以找到\stackinset实际完成图表的嵌套 s。

\documentclass{article}  
\usepackage[usestackEOL]{stackengine}
\usepackage{xcolor,graphicx,amssymb}
\begin{document}
%%%%% THE FOLLOWING IS ME DEFINING THREE GRAPHS; YOUR CODE WILL BE DIFFERENT
\setstackgap{L}{.5cm}
\def\stacktype{L}
% DASHED LINE OF SPECIFIED LENGTH
% From morsburg at http://tex.stackexchange.com/questions/12537/
% how-can-i-make-a-horizontal-dashed-line/12553#12553
\def\solidfill{\cleaders\hbox to .1cm{\rule{.1cm}{1pt}}\hfill}
\newcommand\dashfill[1][.4pt]{\cleaders\hbox to .2cm{\rule{.05cm}{#1}}\hfill}
\newcommand\dashline[2][.4pt]{\hbox to #2{\dashfill[#1]\hfil}}
\newcommand\solidline[1]{\hbox to #1{\solidfill\hfil}}
\newcommand\DL{\textcolor{black!30}{\dashline{4.3cm}}}
\newcommand\SL{\solidline{4.4cm}\makebox[.2cm][r]{\arrowhead}}
\def\arrowhead{\raisebox{-2.6pt}{$\blacktriangleright$}}
\savestack\partblue{\color{blue}\Longstack{\SL\\ \DL\\ \DL\\ \DL\\ \DL\\ \DL\\ \DL\\ \DL\\ \DL}}
\savestack\partred{\color{red}\Longstack{\SL\\ \DL\\ \DL\\ \DL\\ \DL\\ \DL\\ \DL\\ \DL\\ \DL}}
\savestack\partgreen{\color{green}\Longstack{\SL\\ \DL\\ \DL\\ \DL\\ \DL\\ \DL\\ \DL\\ \DL\\ \DL}}
\def\basegrid#1{\color{#1}%
\stackinset{l}{15pt}{t}{3pt}{$y$}{%
  \stackinset{r}{0pt}{b}{12pt}{$x$}{%
    \stackon[-.5cm]{\raisebox{7.5\dimexpr\Lstackgap}{\scalebox{1}[-1]{%
    \csname part#1\endcsname}}}{\rotatebox{90}{\csname part#1\endcsname}}%
}}}
\savestack\gridblue{\basegrid{blue}}
\savestack\gridred{\basegrid{red}}
\savestack\gridgreen{\basegrid{green}}
%%%%%

%%%%% HERE IS WHERE I OVERLAY THE THREE GRAPHS
%%%%% NOTE: \Lstackgap IS THE SPACING BETWEEN DASHED GRID RULES

% ORANGE DASHES
\stackinset{l}{9.5\dimexpr\Lstackgap}{b}{2.1\dimexpr\Lstackgap}{\rotatebox{-115}{%
  \color{orange!90!black}\dashline[2pt]{2.7\dimexpr\Lstackgap}}}{%
\stackinset{l}{3.5\dimexpr\Lstackgap}{b}{0.1\dimexpr\Lstackgap}{\rotatebox{-115}{%
  \color{orange!90!black}\dashline[2pt]{2.7\dimexpr\Lstackgap}}}{%
% OVER STAGGERED GRID
\stackinset{l}{10\dimexpr\Lstackgap}{b}{4\dimexpr\Lstackgap}{\gridred}{%
\stackinset{l}{4\dimexpr\Lstackgap}{b}{2\dimexpr\Lstackgap}{\gridblue}{\gridgreen}}%
}}


\end{document}

在此处输入图片描述

相关内容