2

I would like to embed the following plot:

enter image description here

inside this backup diagram at the place where I've written "hi":

enter image description here

Desired result:

enter image description here

Do you know of any way I could do this with Tikz? Thanks, your help would be greatly appreciated.

EDIT: Here's what I have cobbled together so far, I used the intersections library for it:

% Tree like backup diagram
\tikzset{
state_node/.style={circle, draw=black, scale=1.2},
action_node/.style={circle, fill=black, scale=0.68},
}

\begin{figure} \begin{tikzpicture}[level/.style={sibling distance=18mm/#1}] \node[action_node] (a) {} child {node[state_node] (s) {} child {node[action_node] (a1) {}} child {node[action_node] (a2) {}} child {node[action_node] (a3) {}} }; % I would like the graph to go here \node[below] at (a3.south) {hi};

\draw [->] (a) edge (s); \draw [name path=edge1, ->] (s) to (a1); \draw [name path=edge2, ->] (s) to (a2); \draw [name path=edge3, ->] (s) to (a3);

\path[name path=c] (s) circle (1); \draw[name intersections={of=edge1 and c, by=intersection1}, name intersections={of=edge3 and c, by=intersection2}, -, shorten >=0pt] (intersection1) to[bend right] (intersection2);

\end{tikzpicture} \caption{Q-learning backup diagram} \end{figure}

% Miniature graphs that I would like to embed above \begin{tikzpicture} \begin{axis} [ axis lines=middle, xmin=0, xmax=1, ymin=0, ymax=1, xtick=\empty, ytick=\empty ]

\addplot table { 0.8 0 0.8 0.3 0.3 0.8 0 0.8 };

\addplot table[only marks] { 0.3 0.36 0.8 0.3 0.3 0.8 };

\end{axis} \end{tikzpicture}

  • 1
    Welcome to TeX.SE! Please show us the TeX code you have so far ... Then we have not to guess what you are doing ... – Mensch Jun 14 '21 at 20:24
  • Thank you and sure thing! – Yann Hoffmann Jun 14 '21 at 20:26
  • 1
    Generally speaking, it's not recommended to embed tikzpicture into tikzpicture. And in the present case, it's very hard to figure out what output you expect exactly. Maybe with a sketch? – SebGlav Jun 14 '21 at 20:44
  • What you have provided is insufficient. There are many unresolved tikz labels, for example e1. Also, you haven't specified what documentclass you are using, or what tikzlibraries may be required. – Steven B. Segletes Jun 14 '21 at 20:47
  • @SebGlav I've added the sketch. – Yann Hoffmann Jun 14 '21 at 20:52
  • 1
    See also https://tex.stackexchange.com/questions/47377/proper-nesting-of-tikzpicture-environments-reset-all-pgf-values-to-their-defaul - you shouldn't nest tikzpictures it's not supported and sometimes works but often it doesn't... – Rmano Jun 14 '21 at 21:06
  • @Rmano, it looks like "nested" was the proper way of phrasing it. Thanks for the link I'll see if I can find a solution there. – Yann Hoffmann Jun 14 '21 at 21:11
  • Move the axis environment to inside the first tikzpicture, and add at={(x,y)} to the axis options, where x and y are appropriate coordinates. – Torbjørn T. Jun 14 '21 at 21:41
  • @TorbjørnT., it is a bit fiddly but the result is exactly what I was looking for. Thank you very much. Should I mark this question as resolved? – Yann Hoffmann Jun 14 '21 at 22:03
  • 4
    I’m voting to close this question because it was answered in comments. – SebGlav Jun 15 '21 at 05:30

0 Answers0