The end goal: drawing paths between nodes like in the example there but the difference is the nodes are inside a picture here and in particular, the other node is a bunch of nodes in the same picture. So a minor goal is to be able to refer to some nodes as a whole.

My first attempt was just to wrap the said bunch of nodes in a big node but bizarrely, that didn't work ;). So I had a look at
- How to typeset a TikZ picture inside a node?
- How to nest a graph within a node in TikZ and draw edges between the graphs?
but I still have problems. See the related questions, in particular Q5-Q8 in the example code below. I tried two approaches, the preferred approach would be the one called first try below but that didn't work (Q5). The second approach (using the fit library) is close to what I want but there are still a few flaws left (Q6-Q8).
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,fit}
\begin{document}
\tikzstyle{every picture}+=[remember picture]
\begin{tikzpicture}[scale=1.4]
\begin{scope}[>=stealth]
%% Timeline
\draw (0,0) -- (2.2,0);%
\draw[loosely dotted] (2.5,0) -- (3.5,0);%
%%% Q1: In fact, it would have been great if I could just position
%%% the second part of the graph after the continuation dots in
%%% the next scope. See Q4
\draw (3.8,0) -- (7.2,0);%
\draw[loosely dotted] (7.2,0) -- (7.5,0);%
\draw[->] (7.5,0) -- (7.7,0);%
%%% Q2: Is it possible to use calc or something else to just say 5/N+\x-4
\foreach \x/\xtext in {0,...,2,4/N,5/N+1,6/N+2,7/N+3} {%
\draw[shift={(\x,0)}] (0, +0.2) -- (90:0);%
%%% Q3: How do I put this above the tick without manually
%%% setting 0.3? I'm not sure the draw command allows to write
%%% beyond the path ...
\node at (\x,0.3) {$\xtext$};%
}
\end{scope}
\begin{scope}[>=stealth]
%%% Q4: In fact, I wish I could just say continue at any point,
%%% say 3.5 and just start at 1 instead of 4 in this scope. Is
%%% there a way to say this scope should start at 3.5 in the
%%% current picture?
\draw[shift={(4,0)}] (0,0) -- %
node[very near end,right] {$Div_N$} +(90:-0.2);%
\node[right,fill=red!15,baseline] (continuation) at (4,-0.5) {$+
P_N$};%
% ### First try
%%% It's really what I want to do but I can't succeed in
%%% positioning precisely the nested tikzpicture environment.
%%% Q5: What's going wrong here?
% % Maturity phase
% \node[right,fill=red!15] (maturity) at (5,0) {
% \begin{tikzpicture}
% \draw[shift={(5,0)}] (0,0) -- %
% node[very near end,right] (5) {$Div_{N+1}$} +(90:-0.2);%
% \foreach \x/\xtext in {6/(1+g),7/(1+g)^2} {%
% \draw[shift={(\x,0)}] (0,0) -- %
% node[very near end,right] {$Div_{N+1}$} +(90:-0.2);%
% \node[right] (\x) at (\x,-0.5) {$\times \xtext$};%
% }
% \end{tikzpicture}
% };
% ### Alternative solution with the fit library.
%%% It's very close to the end result but 3 problems here:
%%% Q6: Even playing with the opacity, I can't get the same thing
%%% as with the (continuation) node: I can't see the text as well.
%%% Q7: Adding the inner sep option (see why in Q8) gives
%%% underfull \hbox warning???
%%% Q8: But much worse is the fact that if I get rid of the
%%% ellipse and the inner sep options, the rectangular draw
%%% doesn't include the first $Div_{N+1}$ perfectly
% Maturity phase
\draw[shift={(5,0)}] (0,0) -- %
node[very near end,right] (5) {$Div_{N+1}$} +(90:-0.2);%
\foreach \x/\xtext in {6/(1+g),7/(1+g)^2} {%
\draw[shift={(\x,0)}] (0,0) -- %
node[very near end,right] {$Div_{N+1}$} +(90:-0.2);%
\node[right] (\x) at (\x,-0.5) {$\times \xtext$};%
}
\node[fill=red!15,fill
opacity=0.5,anchor=base,thick,ellipse,fit=(5)(6)(7),inner
sep=3.5pt] (maturity) {};%
\end{scope}
%%% Link both parts
\begin{scope}[overlay,>=stealth,very thick,red!15]
\path[->] (maturity) edge [bend left] (continuation);
\end{scope}
\end{tikzpicture}
\end{document}
