1

In the following plot

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{shapes.arrows,shapes}

\begin{document} \begin{tikzpicture}

\node[draw,ultra thick,above right,] (USR) at (1,7) {User};
\node[draw,ultra thick,below] (MNT) at (-1,-2) {Management};
\draw[-latex,line width=1.mm,teal] (MNT.north) to[ out=120, in=210,] (USR.west);
\draw[-latex,line width=1.mm,teal] (USR.east) to[ out=-30, in=50,] (MNT.east);
%---
\node[] (get) at (-1,4) {\large{GET}};
% \node[below,yshift=-2mm] at (get) {\large{SET}};
\node[] at (2,4) {\large{RESPONSE}};

\end{tikzpicture} \end{document}

enter image description here

I cannot make the text GET, and RESPONSE be placed along the line (sloped). I have tested options pos=0.7, near end, or near start do not work. Finally, the words appear at coordinates to show this example.

pablo
  • 451

2 Answers2

1

enter image description here

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{shapes.arrows,shapes}

\begin{document} \begin{tikzpicture}

\node[draw,ultra thick,above right,] (USR) at (1,7) {User};
\node[draw,ultra thick,below] (MNT) at (-1,-2) {Management};
\draw[-latex,line width=1.mm,teal] (MNT.north) to[ out=120, in=210,]node[above,sloped] (get)  {\large{GET}} (USR.west) ;
\draw[-latex,line width=1.mm,teal] (USR.east) to[ out=-30, in=50,] (MNT.east);
%---
% \node[above,sloped] (get) at (-1,4) {\large{GET}};
% \node[below,yshift=-2mm] at (get) {\large{SET}};
% \node[] at (2,4) {\large{RESPONSE}};

\end{tikzpicture} \end{document}

OR

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{shapes.arrows,shapes,decorations.text}

\begin{document} \begin{tikzpicture}

\node[draw,ultra thick,above right,] (USR) at (1,7) {User};
\node[draw,ultra thick,below] (MNT) at (-1,-2) {Management};
\draw[-latex,line width=1.mm,teal] (MNT.north) to[ out=120, in=210,]node[above,sloped] (get)  {\large{GET}} (USR.west) ;

\def\myshift#1{\raisebox{1ex}}
\draw[-latex,line width=1.mm,teal, postaction={decorate,decoration={text along path,text align=center,text={
|\myshift|some bent text here}}}] (USR.east) to[ out=-30, in=50,] (MNT.east);
%---
% \node[above,sloped] (get) at (-1,4) {\large{GET}};
% \node[below,yshift=-2mm] at (get) {\large{SET}};
% \node[] at (2,4) {\large{RESPONSE}};

\end{tikzpicture} \end{document}

enter image description here

js bibra
  • 21,280
  • How can I control the position, the distance between the two nodes? in the two types. I would like to place the text closer to User node – pablo Aug 16 '21 at 14:52
  • page 646 of the pgf manual here -- https://ctan.asis.ai/graphics/pgf/base/doc/pgfmanual.pdf – js bibra Aug 16 '21 at 15:50
1

If you want the text to follow the curve, you have to use the decorations.text library and some tricks, like in the following:

text along curve

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.text}

\begin{document} \begin{tikzpicture}

\node[draw,ultra thick,above right,] (USR) at (1,7) {User};
\node[draw,ultra thick,below] (MNT) at (-1,-2) {Management};

\def\shft#1{\raisebox{1ex}} % Vertical shift to be used as an argument in the path decoration

\draw[-latex,line width=1.mm,teal,postaction={decorate,decoration={text along path,text align=center,text={|\large\shft|GET SET}}}] (MNT.north) to[ out=120, in=210,] (USR.west);

\draw[-latex,line width=1.mm,teal,postaction={decorate,decoration={text along path,text align=center,text={|\large\shft|RESPONSE}}}] (USR.east) to[ out=-30, in=50,] (MNT.east);
\end{tikzpicture}

\end{document}

SebGlav
  • 19,186