3

How to draw this diagram using latex? this the diagram that I want to draw using latex tikz Here is my code:

\usepackage{tikz}
\usetikzlibrary{shapes, arrows.meta, positioning, fit}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}[
    node distance=2cm and 3cm,
    auto,
    mynode/.style={rectangle, draw, text width=6em, text centered, minimum height=2.5em, minimum width=8em, align=center},
    mynode_cust/.style={rectangle, draw, fill=yellow!30, text width=6em, text centered, minimum height=2.5em, minimum width=8em, align=center},
    mynode_greensupp/.style={rectangle, draw, fill=green!30, text width=6em, text centered, minimum height=2.5em, minimum width=8em, align=center},
    mynode_tradsupp/.style={rectangle, draw, fill=blue!30, text width=6em, text centered, minimum height=2.5em, minimum width=8em, align=center},
    myarrow/.style={-Latex, thick},
    line/.style={draw, thick, -Latex}
]
    % Nodes
    \node[mynode] (government) {Municipal Government};
    \node[mynode_greensupp, below left=of government, node distance=4cm] (green_supplier) {Green Product Supplier};
    \node[mynode_cust, below right=of government, node distance=4cm] (customer) {Customers};
    \node[mynode_tradsupp, right=of customer, node distance=4cm] (traditional_supplier) {Substitute Product Supplier};

    % Arrows
    \draw[myarrow] (government.center) -- node[left] {Supplier subsidy} (green_supplier.center);
    \draw[myarrow] (government.center) -- node[right] {Customer subsidy} (customer.center);
    \draw[myarrow] (customer.center) -- node[below] {Purchase green product} (green_supplier.center);
    \draw[myarrow] (customer.center) -- node[above] {Purchase substitute product} (traditional_supplier.center);

    % Additional information
    \node[align=left, text width=10cm, above=0.5cm of government] (govinfo) 
    {\textbf{Key Problems of the Government:} \\
    \begin{itemize}
        \item How to promote green products to a target level by subsidy? 
        \item How to subsidize both sides of the green supplier and customers?
    \end{itemize}
    };
    \node[align=left, text width=10cm, below=1cm of green_supplier] (suppinfo) 
    {\textbf{Key Problems of the Supplier:} \\
    \begin{itemize}
        \item Heavy cost investment may hurt the positivity for producing.
        \item Green products like EV, shore-to-ship power are not competitive with conventional substitutes like GV, fuel oil.
    \end{itemize}
    };
    \node[align=left, text width=10cm, below=1cm of customer] (custinfo)
    {
    \textbf{Key Problems of Customers:} \\
    \begin{itemize}
        \item Can choose between the green product and other substitute product.
    \end{itemize}
    };
    \node[rectangle, draw, dashed, fit=(government) (govinfo), inner sep=10pt] (govbox) {};
    \node[rectangle, draw, dashed, fit=(green_supplier) (suppinfo), inner sep=10pt, minimum height=4cm] (greenbox) {};
    \node[rectangle, draw, dashed, fit=(customer) (custinfo), inner sep=10pt, minimum height=4cm] (custbox) {};

\end{tikzpicture}
\caption{Comparison of centralized and decentralized supply chain strategies}
\end{figure}

\end{document}"

This is what the code shows in overleaf after compiling. This the code shows in overleaf

1
  • Can you change your question's title to something more descriptive? It's not very helpful for somebody searching for a solution to a similar problem!
    – cfr
    Commented May 14 at 6:31

1 Answer 1

6

You are really very nearly there.

You don't say exactly what you want to change, but I assume you want to sort the arrows out and separate the different areas at the bottom. I've also done a minor amount of tidying of the code, to make it easier to see what is going on. But I only really did this for code I touched.

\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{arrows.meta, positioning, fit}
\begin{document}
\begin{tikzpicture}[
    node distance=2cm and 3cm,
    auto,
    mynode/.style={rectangle, rounded corners, draw, text width=6em, text centered, minimum height=2.5em, minimum width=8em, anchor=center,minimum height=4\baselineskip},
    mynode_cust/.style={mynode, fill=yellow!30},
    mynode_greensupp/.style={mynode, fill=green!30},
    mynode_tradsupp/.style={mynode, fill=blue!30},
    myarrow/.style={-Latex, thick},
    line/.style={draw, thick, -Latex},
    info/.style={align=left, text width=55mm},
  ]
  \sffamily
  % Nodes
  \node[mynode] (government) {Municipal Government};
  \node[mynode_greensupp, below left=3cm and 2cm of government] (green_supplier) {Green Product Supplier};
  \node[mynode_cust, below right=3cm and 2cm of government] (customer) {Customers};
  \node[mynode_tradsupp, right=5cm of customer] (traditional_supplier) {Substitute Product Supplier};
  
  % Arrows
  \draw[myarrow] (government.south) -- node[left] {Supplier subsidy} (green_supplier.north);
  \draw[myarrow] (government.south) -- node[right] {Customer subsidy} (customer.north);
  \draw[myarrow] (customer) -- node[align=center,below,yshift=1.25\baselineskip] {Purchase\\green\\product} (green_supplier);
  \draw[myarrow] (customer) -- node[align=center,below,yshift=1.25\baselineskip,pos=.6] (psp) {Purchase\\substitute\\product} (traditional_supplier);
  
  % Additional information
  \node[info, above=0.5cm of government] (govinfo) 
  {\textbf{Key Problems of the Government:} \\
    \begin{itemize}
      \item How to promote green products to a target level by subsidy? 
      \item How to subsidize both sides of the green supplier and customers?
    \end{itemize}
  };
  \node[info, below=1cm of green_supplier] (suppinfo) 
  {\textbf{Key Problems of the Supplier:} \\
    \begin{itemize}
      \item Heavy cost investment may hurt the positivity for producing.
      \item Green products like EV, shore-to-ship power are not competitive with conventional substitutes like GV, fuel oil.
    \end{itemize}
  };
  \node[info, below=1cm of customer] (custinfo)
  {
    \textbf{Key Problems of Customers:} \\
    \begin{itemize}
      \item Can choose between the green product and other substitute product.
    \end{itemize}
  };
  \begin{scope}[every node/.style={draw,dashed,rounded corners}]
    \node[fit=(government) (govinfo), inner sep=10pt] (govbox) {};
    \node[fit=(green_supplier) (suppinfo), inner sep=10pt, minimum height=4cm] (greenbox) {};
    \node[fit=(customer) (custinfo), inner sep=10pt, minimum height=4cm] (custbox) {};
  \end{scope}
  \draw [ultra thick,-Triangle] (psp.east) ++(0pt,-20mm) coordinate (a) -- node [midway,below] {Cash flow} (traditional_supplier |- a) ;
\end{tikzpicture}
\end{document}

My picture will look like crap, even though the PDF is fine. Apologies for that.

sorted arrows and areas

In case you also wanted to make it fit a portrait page without turning, especially A4, you might try

\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{arrows.meta, positioning, fit}
\begin{document}
\begin{tikzpicture}[
    node distance=2cm and 3cm,
    auto,
    mynode/.style={rectangle, rounded corners, draw, text width=6em, text centered, minimum height=2.5em, minimum width=7em, anchor=center,minimum height=4\baselineskip},
    mynode_cust/.style={mynode, fill=yellow!30},
    mynode_greensupp/.style={mynode, fill=green!30},
    mynode_tradsupp/.style={mynode, fill=blue!30},
    myarrow/.style={-Latex, thick},
    line/.style={draw, thick, -Latex},
    info/.style={align=left, text width=55mm},
  ]
  \sffamily
  % Nodes
  \node[mynode] (government) {Municipal Government};
  \node[mynode_greensupp, below left=3cm and 1.25cm of government] (green_supplier) {Green Product Supplier};
  \node[mynode_cust, below right=3cm and 1.25cm of government] (customer) {Customers};
  \node[mynode_tradsupp, right=3.5cm of customer] (traditional_supplier) {Substitute Product Supplier};
  
  % Arrows
  \draw[myarrow] (government.south) -- node[left] {Supplier subsidy} (green_supplier.north);
  \draw[myarrow] (government.south) -- node[right] {Customer subsidy} (customer.north);
  \draw[myarrow] (customer) -- node[align=center,below,yshift=1.25\baselineskip,pos=.475] {Purchase\\green\\product} (green_supplier);
  \draw[myarrow] (customer) -- node[align=center,below,yshift=1.25\baselineskip,pos=.7] (psp) {Purchase\\substitute\\product} (traditional_supplier);
  
  % Additional information
  \node[info, above=0.5cm of government] (govinfo) 
  {\textbf{Key Problems of the Government:} \\
    \begin{itemize}
      \item How to promote green products to a target level by subsidy? 
      \item How to subsidize both sides of the green supplier and customers?
    \end{itemize}
  };
  \node[info, below=1cm of green_supplier] (suppinfo) 
  {\textbf{Key Problems of the Supplier:} \\
    \begin{itemize}
      \item Heavy cost investment may hurt the positivity for producing.
      \item Green products like EV, shore-to-ship power are not competitive with conventional substitutes like GV, fuel oil.
    \end{itemize}
  };
  \node[info, below=1cm of customer,text width=50mm] (custinfo)
  {
    \textbf{Key Problems of Customers:} \\
    \begin{itemize}
      \item Can choose between the green product and other substitute product.
    \end{itemize}
  };
  \begin{scope}[every node/.style={draw,dashed,rounded corners, inner ysep=10pt}]
    \node[fit=(government) (govinfo)] (govbox) {};
    \node[fit=(green_supplier) (suppinfo), minimum height=4cm] (greenbox) {};
    \node[fit=(customer) (custinfo),  minimum height=4cm] (custbox) {};
  \end{scope}
  \draw [ultra thick,-Triangle] (psp.east) ++(0pt,-20mm) coordinate (a) -- node [midway,below] {Cash flow} (traditional_supplier |- a) ;
\end{tikzpicture}
\end{document}

which is only a little more fiddly.

more compact version

But this may still be too wide for your text block, in which case you could consider shrinking the font sizes or squeezing things further. However, I'd use sidewaysfigure from the rotating package in that case, as there is plenty of room to use it that way without squashing anything.

[Is it just me or does the second image look even blurrier than the first?]

4
  • 1
    Blurs to me too …
    – MS-SPO
    Commented May 14 at 6:20
  • @MS-SPO I keep fiddling with my glasses ....
    – cfr
    Commented May 14 at 6:28
  • 1
    Well, I can see the 2nd blurr even without glasses … It’s not much, but noticeable… What‘s the difference between the two?
    – MS-SPO
    Commented May 14 at 9:55
  • 1
    @MS-SPO I'm not sure. Both were done with convert <filename>.pdf <filename>.png. The only difference is in the size of the PDF, but I don't see why that should make a difference to the quality of the result?
    – cfr
    Commented May 14 at 14:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .