I have a very specific problem that repeats several times. On picture I have a line and above line I have an arrow with a node. Because of the line, node is not visible enough (picture left). What I want to do is to make line more transparent. I tried fill opacity, which is good in a way it makes line grey, but it also makes grey text as well as arrow (picture right).
Is there a way to make only line grey?
MWE
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[>=stealth]
\draw (0,0) -- (0,2);
\draw[ultra thick,->] (2,2) -- (0.1,1) node[below left=-3pt,inner sep=0.5pt] {$\Phi_{x+\Delta x}$};
\end{tikzpicture}
\begin{tikzpicture}[>=stealth]
\draw (0,0) -- (0,2);
\draw[ultra thick,->] (2,2) -- (0.1,1) node[rectangle,rounded corners=3pt,fill=white,fill opacity=0.5,below left=-3pt,inner sep=0.5pt] {$\Phi_{x+\Delta x}$};
\end{tikzpicture}
\end{document}
EDIT: In recently deleted response, I've learned that text opacity=1
solves the problem in a way it makes text black, but I still don't know how to prevent arrow to become grey.
Best Answer
You could use the idea of
layers
, as demonstrated in Draw edges and paths in the background of nodes in TikZ, for example, combined with thetext opacity
key.The idea is to draw your vertical line and node in the back ground, and then the arrow on top.