1

I asked this question one week ago. I would like to re-propose the same problem where I provided a MWE and a photo to read as follows: the tikzpicture above the word "But I'd like this" is the output of the code to be modified, while in the other tikzpicture under the same wording there are two dashed arrows like so [-latex, shorten >= 3pt]. What I would like to have is a tikzpicture with a dashed arrow (the upper one) that is blue to red, i.e., the hatching starts first with blue and then fades and becomes red towards the end of the arrow (the arrowhead must also be red).

Thank you so much.

Multicolored arrows

\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}

\Large

\begin{center} \begin{tikzpicture}[line cap=round, line join=round]

\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, thick, dashed, -stealth, -latex, shorten >= 3pt] (-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}

But I'd like this

\begin{center} \begin{tikzpicture}[line cap=round, line join=round]

\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}

\begin{scope}[thick, dashed, -latex, shorten >= 3pt]

\draw (-2,3.5) to[out=15, in=155] node[above, font=\Large]{$f$} ( 2.5, 3.25);

\draw (-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{scope} \end{tikzpicture} \end{center}

\end{document}

Marijn
  • 37,699
Puck
  • 1,208
  • 1
    You should not repost a question, but edit the original. It is not possible to help now as it is not known which one or both questions you delete or are closed. – hpekristiansen Oct 21 '22 at 03:35

0 Answers0