3

I want to insert an image instead of the blue rectangle drawn by Tikz.

\documentclass{article}

\usepackage{tikz}



\begin{document}


\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,741); %set diagram left start at 0, and has height of 741

%Shape: Rectangle [id:dp7318361349835825]
\draw  [fill={rgb, 255:red, 3; green, 42; blue, 90 }  ,fill opacity=1 ] (49,100) -- (597,100) -- (597,631) -- (49,631) -- cycle ;
%Rounded Rect [id:dp6003532783152192]
\draw  [fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=1 ] (192,502) .. controls (192,492.06) and (200.06,484) .. (210,484) -- (341,484) .. controls (350.94,484) and (359,492.06) .. (359,502) -- (359,614) .. controls (359,623.94) and (350.94,632) .. (341,632) -- (210,632) .. controls (200.06,632) and (192,623.94) .. (192,614) -- cycle ;
%Rounded Rect [id:dp6087048165722606]
\draw  [fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=1 ] (186,112) .. controls (186,104.76) and (191.87,98.9) .. (199.1,98.9) -- (445.9,98.9) .. controls (453.13,98.9) and (459,104.76) .. (459,112) -- (459,191.8) .. controls (459,199.03) and (453.13,204.9) .. (445.9,204.9) -- (199.1,204.9) .. controls (191.87,204.9) and (186,199.03) .. (186,191.8) -- cycle ;

% Text Node
\draw (265,553) node [xslant=-0.02] [align=left] {\textbf{{\LARGE \textcolor[rgb]{0.7,0,0}{XXX} }}\\[0.5em]\textbf{{\LARGE \textcolor[rgb]{0.7,0,0} {XXX}}}\\[0.5em]\textbf{{\LARGE \textcolor[rgb]{0.7,0,0} {XXX}}}\\\\\textcolor[rgb]{0.9,0,0} {XXX}};
\end{tikzpicture} 


\end{document}
  • (1) Welcome. (2) You should never use a generator for not-too-complicated figures, please read the manual and write the code yourself. (3) I think you already get what you want, as I can see an image there. – user156344 May 22 at 12:50
  • Are you looking for \draw (329,147) node[draw] {\includegraphics[width=157.5pt,height=55.5pt]{Logo.png}};? I.e. add [draw] to the node? – user121799 May 22 at 13:11
2

You can use \stackinset of the stackengine package to overlay stuff, including tikz pictures.

\documentclass{article}
\usepackage{tikz,stackengine}
\usetikzlibrary{arrows.meta}
\begin{document}
\fboxsep=6pt
\stackinset{r}{}{c}{}{\scalebox{.35}{\begin{tikzpicture}
        \begin{scope}[every node/.style={circle,thick,draw}]
            \node (A) at (-12,-2)  {N5xx};
            \node (B) at (-10,4)   {N612};
            \node (C) at (-5,7)    {N614};
            \node (D) at (0,4)     {N624};
            \node (E) at (2,-2)    {N7070};
            \node (F) at (-1,-8)   {N7071};
            \node (G) at (-9,-8)   {Others};
        \end{scope}
%
        \begin{scope}[>={Stealth[black]},
                    center coordinate every node/.style={fill=white,circle},
                     % every edge/.style={draw=red,very thick}
                     ]
            \path [->] (A) edge[bend left = 15, blue,very thick]   node {$5$}  (B);
            \path [->] (A) edge[bend left = 15, blue,very thick]   node {$3$}  (C);
            \path [->] (A) edge[bend left = 15, blue,very thick]   node {$4$}  (D);
            \path [->] (A) edge[bend left = 15, blue,very thick]   node {$3$}  (E);
            \path [->] (A) edge[bend right = 25, blue,very thick]  node {$3$}  (F);
            \path [->] (A) edge[bend right = 25, blue,very thick]  node {$3$}  (G);
            \path [->] (A) edge[loop left = 25, blue,very thick]   node {$3$}  (A);
%
            \path [->] (B) edge[loop left = 15, red,very thick]   node {$5$}  (B);
            \path [->] (B) edge[bend right = 25, red,very thick]   node {$3$}  (A);
            \path [->] (B) edge[bend left = 15, red,very thick]   node {$3$}  (C);
            \path [->] (B) edge[bend left = 15, red,very thick]   node {$4$}  (D);
            \path [->] (B) edge[bend left = 15, red,very thick]   node {$3$}  (E);
            \path [->] (B) edge[bend right = 25, red,very thick]  node {$3$}  (F);
            \path [->] (B) edge[bend right = 25, red,very thick]  node {$3$}  (G);
%
            \path [->] (C) edge[green,very thick]   node {$3$}  (A);
            \path [->] (C) edge[bend right = 30, green,very thick]   node {$5$} (B);
            \path [->] (C) edge[loop above = 15, green,very thick]  node {$3$}  (C);
            \path [->] (C) edge[bend left = 30, green,very thick]   node {$4$}  (D);
            \path [->] (C) edge[ green,very thick]   node {$3$}  (E);
            \path [->] (C) edge[bend left = 5, green,very thick]  node {$3$}  (F);
            \path [->] (C) edge[bend right = 5, green,very thick]  node {$3$}   (G);
%
            \path [->] (D) edge[bend left = 25, orange,very thick]    node {$3$}  (A);
            \path [->] (D) edge[bend left = 15, orange,very thick]    node {$5$}  (B);
            \path [->] (D) edge[bend right = 15,orange,very thick]   node {$3$}  (C);
            \path [->] (D) edge[loop right = 15,orange,very thick]   node {$4$}  (D);
            \path [->] (D) edge[bend left = 15, orange,very thick]    node {$3$}  (E);
            \path [->] (D) edge[bend left = 25,orange,very thick]   node {$3$}  (F);
            \path [->] (D) edge[bend left = 25,orange,very thick]   node {$3$}  (G);
%
            \path [->]  (E) edge[bend left = 25, purple!50 ,very thick]    node {$3$}  (A);
            \path [->]  (E) edge[bend left = 15, purple!50,very thick]    node {$5$}  (B);
            \path [->]  (E) edge[bend right = 15,purple!50,very thick]    node {$3$}  (C);
            \path [->]  (E) edge[bend right = 15,purple!50,very thick]    node {$4$}  (D);
            \path [->]  (E) edge[loop right = 15, purple!50,very thick]    node {$3$}  (E);
            \path [->]  (E) edge[bend left = 25,purple!50,very thick]     node {$3$}  (F);
            \path [->]  (E) edge[bend left = 25,purple!50,very thick]     node {$3$}  (G);
%
             \path [->]  (F) edge[bend left = 25, very thick]    node {$3$}  (A);
            \path [->]  (F) edge[bend left = 15, very thick]    node {$5$}  (B);
            \path [->]  (F) edge[bend right = 15,very thick]    node {$3$}  (C);
            \path [->]  (F) edge[bend right = 15, very thick]    node {$4$}  (D);
            \path [->]  (F) edge[bend right = 15, very thick]    node {$3$}  (E);
            \path [->]  (F) edge[loop right = 25,very thick]     node {$3$}  (F);
            \path [->]  (F) edge[bend left = 25,very thick]     node {$3$}  (G);
%
        \end{scope}
%
        \end{tikzpicture}}%
}{%
\stackinset{c}{-2.5cm}{b}{}{\colorbox{white}{\parbox{80pt}{\bfseries\LARGE
  \color[rgb]{0.7,0,0} XXX \\[0.2em] XXX\\[0.2em] XXX\\\\\normalsize
  \mdseries\textcolor[rgb]{0.9,0,0} {XXX}}}}{%
\stackinset{c}{}{t}{}{\includegraphics[width=157.5pt,height=55.5pt]{example-image}}
{\includegraphics[width=13cm,height=13cm]{example-image-a}}}}
\end{document}

enter image description here

  • This solution worked for me. However the image is not centered. I need it to be centerd and i wanna add some text on it – Imade May 23 at 0:30
  • @Imade Which image is not centered? One of the insets, or the large background image? – Steven B. Segletes May 23 at 0:31
  • the large background image is not centered – Imade May 23 at 0:32
  • 1
    @Imade It is set just like a letter of text (i.e., in horizontal mode). Thus, you can enclose the whole thing in \begin{center}...\end{center}, or use {\centering...\par}. – Steven B. Segletes May 23 at 0:34
  • 1
    @Imade \stackinset{c}{}{c}{}{<inset>}{<background>} – Steven B. Segletes May 23 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.