I have different elements (say, a node and a filled circle) defined using a single path:
\path (0,0)
node [blue] {some text}
[fill, red] circle [radius = 1];
Issue: I would like to put one of these elements (the circle) on a given layer (that is the background layer).
I have tried [fill, red, on background layer]
as option but it doesn't work. I cannot open/close a scope environment in the middle of a path neither.
MWE
The example below is constructed as following:
- some elements (here a black line),
- a path containing a node with text and a circle.
Resulting layers are thus (considering first bullet = top layer) :
- text + circle,
- some elements.
However, I'd like to have:
- text,
- some elements,
- circle.
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, fadings, backgrounds}
\begin{document}
\begin{tikzpicture}
\draw [very thick] (-1,-1) -- (1,1);
\path (0,0)
node [red!20, font=\sffamily\bfseries] {some text}
[fill, red, on background layer] circle [radius=1];
\node at (0,2) {actual trial};
\begin{scope}[xshift=-3cm]
\path (0,0) [fill, red, on background layer] circle [radius = 1];
\draw [very thick] (-1,-1) -- (1,1);
\path (0,0) node [red!20, font=\sffamily\bfseries] {some text};
\node at (0,2) {expected};
\end{scope}
\end{tikzpicture}
\end{document}
Edit:
For a better understanding, here is my real problem that is abstracted hereinabove. In following picture, I want the text to be above the axes (as it is now), and the shading below (it is not the case)... and I want to draw both of them using on unique command.