I have a contour plot in the background, and on top of it I want to plot some data stored in a file. I would like to label my line with a text that cuts the line, but I haven't been able to get a transparent background. All examples I find online just have a white background, which is not ideal.
My attempt so far is:
\documentclass[11pt]{article}
\usepackage[top=2.54cm, bottom=2.54cm, left=2.75cm, right=2.75cm]{geometry}
\usepackage{float}
\usepackage{subcaption}
\usepackage{pgfplots}
\usepackage{amsmath}
\begin{filecontents*}{Colour}
1 1 1
1 2 1
1 3 1
2 1 2
2 2 2
2 3 2
3 1 3
3 2 3
3 3 3
\end{filecontents*}
\begin{filecontents*}{Line}
1 1
3 3
\end{filecontents*}
\begin{document}
\begin{figure}[H]
\begin{tikzpicture}
\begin{axis}
[
view={0}{90},
only marks,
colorbar,
colorbar style ={width = 6}
]
\addplot3[contour filled={number=40}]
table[x index =0,y index=1,z index=2]{Colour};
\addplot[smooth]
table[x index=0,y index=1]{Line} node[pos = 0.5, sloped, fill=white,minimum size=1mm,inner sep=0,rectangle]{Text};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
Which looks like:


