I am trying to draw a picture that would look complexity-wise like this

enter image description here

But instead of making it rectangular-looking, I need to make it triangular-looking that would look something like this (but will similar comments surrounding the figure). Thank you for any feedback.

enter image description here


\tikz {
  \node[draw,rectangle] (a) at (0,2) [rounded rectangle] {Sales Response};
\node[draw,rectangle] (b) at (5,2) [rounded rectangle] {Optimal Labor};
\node[draw,rectangle] (d) at (2,0) [rounded rectangle] {Profit Maximization};
\draw (a) edge[->] (b)
      (b) edge[->] (d) (d) edge[<-] (a);

  • Please make your code compilable by completing it suitably. That is much more useful than a mere fragment of code, especially one which mixes preamble with document commands and loads an imaginary package :-). – cfr Jun 21 '16 at 21:51

Another verbose solution:

enter image description here

\documentclass[border = 2cm]{standalone}
\usetikzlibrary{arrows.meta,positioning, shapes}


\begin{tikzpicture}[node distance = 2.5 cm,
block/.style = { rectangle,draw,  rounded corners, text width = 4 cm, minimum height = 2cm, align = center},
arrow/.style = {-Triangle,  very thick}]

\node[block](optimal){Optimal Labor \\$L_{it}^{*} = f(N_{i,t - p})$ };
\node[block, above left = of optimal](sales){Sales Response \\ $S_{it}= f(N_{it}, L_{it})$};
\node[block, above right = of optimal](profit){Profit maximization\\ $(\pi(L_{it}), \pi(\hat{L}_{it} ), \pi(L_{it}))$};

\draw[arrow] (sales.south) -- node[left, xshift = -0.5cm, yshift = -0.5cm, text width = 2cm, align = center]{Estimates of \\ $(\alpha, \beta, \gamma)$}(optimal.north);
\draw[arrow](optimal.north)--node[right, xshift = 0.5cm, yshift = -0.5cm, text width = 2cm, align = center]{Estimates of\\ $(\theta_{o}, \theta_{p}, d)$}(profit.south);
\draw[arrow](sales)--node[above, text width = 2cm, align = center]{Estimates of \\ $(\alpha, \beta, \gamma)$}(profit);

\node[above]at(sales.north){Fit Sample (Weeks 1 - 40)};
\node[above]at(profit.north){Test Samples (Weeks 41 -- 52)};
\node[below right, yshift = -1.5cm, text width = 2cm, align = left]at(profit.south){$h = \dfrac{\pi(\hat{L}_{it})}{\pi(L_{it} ^{*})}$ \\ [5pt] $a = \dfrac{\pi(L_{it} ^{a})}{\pi(L_{it} ^{*})}$  };
  • Hi Carlos, some of your arrows are pointing in the wrong direction. "Sales response" and "profit maximization" should point into "optimal labor". – Olga Jun 24 '16 at 15:58

This is an annotated version of a Minimal Working Example based on a corrected version of the code posted in the question.

Colours are used to indicate which elements of the existing diagram are associated with particular labels.

  • Blue, red and green show labels added to the three nodes as part of the \node operation.

  • Orange, magenta and cyan-blue show labels added to the three edges as part of the edge operation using the quotes library.

In the case of the node labels, every label is used to allow multi-line labels, with centre alignment.

every edge quotes is used to achieve the same for the edge labels. This makes it possible to write "<label>" in the style options for the edge and "<label>"' to swap the position by flipping it across the path to the other side.

The locations of the node labels are specified using either a specified angle (e.g. -5) or a description (e.g. below). In some cases, the position is adjusted by giving the anchor for the node label.

\begin{tikzpicture}[every label/.append style={align=center}, every edge quotes/.append style={align=center}]
  \node [draw, blue, rounded rectangle, label={[blue]left:Here is a label\\left of a node}, label={[blue]above:This diagram has\\many too many\\labels \dots}] (a) at (0,2)  {Sales Response};
  \node [draw, red, rounded rectangle, label={[red]above:Here is a long label\\above a node}] (b) at (5,2)  {Optimal Labor};
  \node [draw, green!75!black, rounded rectangle, label={[green!75!black]below:Here is a long label\\below a node}, label={[green!75!black,anchor=north east]-175:Yet another\\label}, label={[green!75!black,anchor=west]-5:Still another}] (d) at (2,0)  {Profit Maximization};
  \draw (a) edge [->, blue!50!cyan, "Something here", "and there"'] (b) (b) edge [->, magenta, "Something everywhere\\and nowhere"] (d) (d) edge [<-, orange, "An unlabelled edge", "\& a paradox"'] (a);

label variations


Please post a M[W]E next time. Here is an illustration of how to place nodes close to existing nodes or lines :



\tikz {
\node[draw, rounded rectangle] (a) at (0,2) {Sales Response};
\node[draw, rounded rectangle] (b) at (5,2) {Optimal Labor};
\node[draw, rectangle, rounded corners=1mm, text width=2cm] (d) at (2,0) {Profit Maximization};
\draw (a) edge[->] node[above] {hello} (b)
      (b) edge[->] node[right] {hi!} (d) 
      (d) edge[<-] node[above, sloped] {comment} (a);
\node[above] at (a.north) {some text};
\node[below] at (d.south) {more text};


Plus I changed the shape of node (d) to come closer to your original example. enter image description here

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.