About this code, I have a problem with the colors of the arrows: I'd like to make two arrows such that the first of these starts with blue and ends red. Why if I write this code, LaTeX colors the space under the arrows?
The code
\PassOptionsToPackage{svgnames, x11names}{xcolor}
\documentclass{article}
\usepackage[a4paper,top=3cm,bottom=3cm,left=1.5cm,right=1.5cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{amssymb}
\usepackage{extarrows}
\usepackage{stix}
\usepackage{tikz}
%\usetikzlibrary{decorations.markings}
\usepackage[bb=ams]{mathalpha}
\newcommand{\Tonde}[1]{\left(#1\right)}
\newcommand{\tonde}[1]{\bigl(#1\bigr)}
\begin{document}
\begin{center}
\begin{tikzpicture}
\draw[thick, dashed, -latex, shorten >= 3pt, left color = blue, right color = red]
(-2, 3.5)
to[out=15, in=155] node[above, font=\Large]{$f$}
( 2.5, 3.25);
\draw[thick, dashed, -latex, shorten >= 3pt, left color = green, right color = Silver]
(-1.25,2.75)
to[out=15, in=155] node[above, font=\Large]{$\bar f$} node[below, font=\Large]{$\eqqsim$}
( 3.00,2.25);
\end{tikzpicture}
\end{center}
\end{document}
First Edit: I edited previous code into
\PassOptionsToPackage{svgnames, x11names}{xcolor}
\documentclass[a4paper]{article}
\usepackage{stix}
\usepackage{tikz}
\usetikzlibrary{fadings,decorations.pathmorphing}
\makeatletter
\newif\iftikz@shading@path
\tikzset{
% Need this for the bounding box calculation of the
% fading and the rectangle that bounds the fading.
% If set to zero things (e.g., arrows) may get cut off.
fading sep/.store in=\fadingsep,
fading sep=0.25cm,
shaded path/.code={%
% Prevent this stuff happning recursively.
\iftikz@shading@path%
\else%
\tikz@shading@pathtrue%
\tikz@addmode{%
% Interrupt the picture to create a fading.
\pgfinterruptpicture%
\begin{tikzfadingfrompicture}[name=.]
\path [shade=none,fill=none]#1;%
% Need to set the bounding box manually. Include the \fadingsep border.
\xdef\fadingboundingbox{{\noexpand\pgfpoint{\the\pgf@picminx-\fadingsep}{\the\pgf@picminy-\fadingsep}}%
{\noexpand\pgfpoint{\the\pgf@picmaxx+\fadingsep}{\the\pgf@picmaxy+\fadingsep}}}%
\expandafter\pgfpathrectanglecorners\fadingboundingbox%
\pgfusepath{discard}%
\end{tikzfadingfrompicture}%
\endpgfinterruptpicture%
% Install a rectangle that covers the shaded/faded path.
\expandafter\pgfpathrectanglecorners\fadingboundingbox%
% Make the fading happen.
\def\tikz@path@fading{.}%
\tikz@mode@fade@pathtrue%
\tikz@fade@adjustfalse%
\pgfpointscale{0.5}{\expandafter\pgfpointadd\fadingboundingbox}%
\def\tikz@fade@transform{shift={(\the\pgf@x,\the\pgf@y)}}%
}%
\fi%
}
}
\begin{document}
\begin{tikzpicture}[line cap=round, line join=round]
\path[font=\Huge]
(-5.5, 2.5) node[blue] {$U$}
( 7.25, 2.5) node[red] {$V$}
(-3.5, 2.5) node[green] {$U'$}
( 5.75, 2.5) node[Silver] {$V'$};
\path[save path=\pathU]
(-6, 0.5) to[out= 80, in=310, looseness=1] (-4.5, 3)
to[out=140, in=160, looseness=1] (-3, 4)
to[out=-30, in=160] (-1, 3)
to[out=-20, in=100] ( 0, 2)
to[out=-90, in= 15, looseness=1] (-1, 0.5)
to[out=190, in=-10] (-2, 0.75)
to[out=170, in= 10, looseness=1.5] (-5, 0)
to[out=190, in=270, looseness=1.5] (-6, 0.5);
\begin{scope}
\clip[use path=\pathU];
\draw[very thin, dashed, cyan, step=0.5] (-6, 0) grid (0, 4);
\end{scope}
\draw[thick, blue, use path=\pathU];
\path[save path=\pathV]
(2.25, 1) to[out= 90, in=180, looseness=1.8] (4.50, 3.50)
to[out= 45, in= 90, looseness=1.25] (6.50, 2.25)
to[out=-90, in=-20, looseness=1.75] (4.50, 0.50)
to[out=170, in=-75, looseness=1] (2.25, 1 );
\begin{scope}
\clip[use path=\pathV];
\draw[very thin, dashed, orange]
\foreach\x in{2, 2.5, ..., 6}
{
(\x, 4) to (\x, 3.5)
to (\x, 3.25)
to (\x, 2.25)
to (\x, 1.25)
to (\x, 0.75)
to (\x, 0.25)
}
\foreach\y in{3.25, 2.75, ..., 0.25}
{(2, \y) to (6.5, \y)};
\end{scope}
\draw[thick, red, use path=\pathV];
\path [left color=red, right color=blue, shaded path={
[draw=transparent!0, ultra thick, -stealth] (-2, 3.5)
to[out=15, in=155] node[above, font=\Large]{$f$}
( 2.5, 3.25);
}];
\path [left color=green, right color=Silver, shaded path={
[draw=transparent!0, ultra thick, -stealth]
(-1.25,2.75)
to[out=15, in=155] node[above, font=\Large]{$\bar f$} node[below, font=\Large]{$\eqqsim$}
( 3.00,2.25);
}];
\draw[thick, dashed, -latex, shorten >= 3pt, color = Goldenrod] (4,2.25) to[out=240, in=-60] node[below, font=\Large]{$g=f^{-1}$} (-2,2);
\begin{scope}[thick]
\draw[color = green] (-2,2.00) circle (1cm);
\draw[color = Silver] ( 4,2.25) circle (1cm);
\draw[color = green] (-2,2) circle (1.5pt) node[above]{$u$};
\draw[color = Silver] (4,2.25) circle (1.5pt) node[above]{$v$};
\end{scope}
\end{tikzpicture}
\end{document}
Second Edit: Compiling the new code, I obtain an undesired result: what I'd like is to create this two arrows that I previously described.
Third Edit: I corrected my code, but there are no arrowheads. Also, colored squares appear on the nodes (why?). Could someone correct my code please?
Thank you so much

shading pathat the very least. Then you need to put the options likeleft colorandright coloras parameters toshading pathand not on the path directly. (That will shade the arc, not the line.) – Qrrbrbirlbel Oct 20 '22 at 18:43