I have a network described by two graph layers, where in both layers I have to draw a different graph. Each level describes a different abstraction level, where one could be expanded into more components, as in the following code, where Firms contains Firma1 and Firma2.
% Interaction diagram
% Author: Pascal Seppecher
% Based on diagram from Marco Miani.
\documentclass{article}
\usepackage{tikz}
%%%<
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\usetikzlibrary{fit,shapes}
\setlength\PreviewBorder{5pt}%
%%%>
\begin{comment}
:Title: Interaction diagram
:Tags: Scopes,3D, Diagrams,Transparency,Economics,Computer Science
:Author: Pascal Seppecher
:Slug: interaction-diagram
Real and monetary flows in an agent-based
macroeconomic model with endogenous money.
\end{comment}
\usetikzlibrary{positioning}
\newcommand{\MonetaryLevel}{Monetary level}
\newcommand{\RealLevel}{Real level}
\newcommand{\Firms}{Firms}
\newcommand{\Households}{Households}
\newcommand{\Banks}{Banks}
\newcommand{\Commodities}{Commodities}
\newcommand{\LaborPower}{Labor power}
\newcommand{\Wages}{Wages}
\newcommand{\Consumption}{Consumption}
\newcommand{\Credits}{Credits}
\newcommand{\Withdrawals}{Withdrawals}
\newcommand{\Deposits}{Deposits}
\newcommand{\Repayments}{Repayments}
\newcommand{\yslant}{0.5}
\newcommand{\xslant}{-0.6}
\begin{document}
\begin{tikzpicture}[scale=1.1,every node/.style={minimum size=.1cm},on grid]
% Real level
\begin{scope}[
yshift=-120,
every node/.append style={yslant=\yslant,xslant=\xslant},
yslant=\yslant,xslant=\xslant
]
% The frame:
\draw[black, dashed, thin] (0,0) rectangle (7,7);
% Agents:
\node[fill=red,draw=black,label=above:\textbf{firma1}] at (3,3) (a) {};
\node[fill=red,draw=black,label=above:\textbf{firma2}] at (5,3) (b) {};
\node[ellipse,fit=(a) (b), fill=red,draw=black, opacity=0.5] (c) {};
\end{scope}
% 2 vertical lines for linking agents on the 2 levels
\draw[ultra thin](3.8,4) to (c.west);
\draw[ultra thin](3.8,4) to (c.east);
% Monetary level
\begin{scope}[
yshift=0,
every node/.append style={yslant=\yslant,xslant=\xslant},
yslant=\yslant,xslant=\xslant
]
% The frame:
\fill[white,fill opacity=.75] (0,0) rectangle (7,7); % Opacity
\draw[black, dashed, thin] (0,0) rectangle (7,7);
% Agents:
\draw [fill=red]
(5,2) circle (.1) % Firms
(2,2) circle (.1) % Households
(3.5,5) circle (.1); % Banks
% Monetary Flows:
\draw[-latex, thin]
(3.65,5.1) to[out=30,in=30] (5.15,2.1); % Credits
\draw[-latex, thin]
(5,1.8) to[out=-90,in=-90] (2,1.8); % Wages
\draw[-latex, thin]
(1.9,2.1) to[out=150,in=150] (3.4,5.1); % Deposits
\draw[-latex, thin]
(3.6,4.9) to[out=-30,in=-30] (2.1,1.9); % Withdrawals
\draw[-latex, thin]
(2,2.2) to[out=90,in=90] (5,2.2); % Consumption
\draw[-latex, thin]
(4.85,1.9) to[out=210,in=210] (3.35,4.9) ; % Repayments
% Labels:
\fill[black]
(0.5,6.5) node[right, scale=.7] {\MonetaryLevel}
(5.1,1.9) node[right,scale=.7]{\textbf {\Firms}}
(1.9,1.9) node[left,scale=.7]{\textbf {\Households}}
(3.5,5.1) node[above,scale=.7]{\textbf {\Banks}}
(5.5,2.8) node [above, scale=.6, rotate=-100] {\Credits}
(2.6,1.3) node [above, scale=.6, rotate=-10] {\Withdrawals}
(2.9,4.25) node [above, scale=.6, rotate=50] {\Repayments}
(2.6,5) node [above, scale=.6, rotate=25] {\Deposits}
(4.7,2.9) node [above, scale=.6, rotate=-60] {\Consumption}
(2.3,1.3) node [below, scale=.6, rotate=-40] {\Wages};
\end{scope}
\end{tikzpicture}
\end{document}
The two nodes, Firma1 (node a
) and Firma2 (node b
), are contained inside another node (node c
). In order to remark the containment relation, I would like to draw a truncated cone delimited by node c
and Firms. Is there a way to do it without defining the explicit coordinates between the two and giving a tridimensional aspect to it? Thanks in advance.