1

I would like place to figures/graphs next to each other. So far, I've managed to create the first figure and parts of the second figure. I don't know how to place them next to each other and how to color the different regions of the figures or insert tags inside the areas.

Desired output:

enter image description here

Curent output

enter image description here

Current code

\documentclass{article}
\usepackage{tikz}

\begin{document}

    \begin{tikzpicture}[domain=0:2,scale=1.2,thick]
    % coordinates path with intersections
\coordinate (O)     at  (0,0);
    % coordinate axes
\draw[->]   (O) -- + (9,0)  node[right] {$Q$};
\draw[->]   (O) -- + (0,6)  node[above] {$P$};
    % line MC
\draw[line width=1mm, purple]
    (0,1) -- + (7.7,0) node[right] {$MC$};
    % line MR
\draw[line width=0.8mm, dashed , black]
    (0,5.7) -- (4,0) node[below] {$MR$};    
    % line D
\draw[line width=0.8mm, black]
    (0,5.7) -- (7,0) node[below] {$D$};
    % line Q
\draw[line width=0.2mm, black]
    (3.3,0) -- + (0,3) node[below] {$Q$};    
    % line P
\draw[line width=0.2mm, black]
    (0,3) -- + (3.3,0) node[left] {$P$};    
    \end{tikzpicture}

    \begin{tikzpicture}[domain=0:2,scale=1.2,thick]
    % coordinates path with intersections
\coordinate (O)     at  (0,0);
    % coordinate axes
\draw[->]   (O) -- + (9,0)  node[right] {$Q$};
\draw[->]   (O) -- + (0,6)  node[above] {$P$};
    % line MC
\draw[line width=1mm, purple]
    (0,1) -- + (7.7,0) node[right] {$MC$};
    % line P_2
\draw[line width=0.2mm, black]
    (0,3) -- + (3.3,0) node[left] {$P_2$};
    % line P_1
\draw[line width=0.2mm, black]
    (0,2) -- + (4.5,0) node[left] {$P_1$};
    % line Q_2
\draw[line width=0.2mm, black]
    (3.3,0) -- + (0,3) node[below] {$Q_2$};
    % line Q_1
\draw[line width=0.2mm, black]
    (4.5,0) -- + (0,2) node[below] {$Q_1$};    
    % line D_1
\draw[line width=0.8mm, black]
    (0,5.7) -- (7,0) node[below] {$D_1$};
    \end{tikzpicture}

\end{document}
  • 3
    Remove empty line in code between both pictures. It require to move next picture in new line. – Zarko Jul 24 '16 at 11:29
  • 2
    And use scale=0.75. With scale=1.2 both figures can't fit on a single line. – Bernard Jul 24 '16 at 11:33
  • Thank you, both. So far the two figures are on the same line. Is it possible to color the different areas? – Saud Jul 24 '16 at 12:25
1

I finish only left image, the second you can finish on similar way:

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{backgrounds, scopes}

\usepackage[showframe]{geometry}

\begin{document}
\begin{center}%
    \begin{tikzpicture}[scale=0.8,
    thick,
L/.style args = {#1/#2}{% L: line
    line width=#1,
    draw = #2 %color
                },
L/.default = 0.8mm/black,
 NS/.style = {%N: Node Shape
    text=black, font=\Large,}
                    ]
    % coordinates path with intersections
\coordinate (O)     at  (0,0);
    % coordinate axes
\draw[->]   (O) -- + (6.5,0)  node[right] {$Q$};
\draw[->]   (O) -- + (0,6.5)  node[above] {$P$};
    % line P -- Q
\draw[densely dotted, fill=orange!80]
    (0,3) node[left] {$P$} -| (3,0) node[below] {$Q$}
                           -| (0,3) node[NS,pos=0.25,above=1mm] {$\pi$};
    % DL area
\fill[gray!30]
    (3,3) -- (6,0) -- node[NS,above=1mm] {DL} (3,0) -- cycle;
    % CS area
\fill[orange!40]
    (0,3) -- node[NS,pos=0.25,above=1mm] {CS} (3,3) -- (0,6) -- cycle;
    % line MC
\draw[L=1mm/purple]
    (0,1) -- + (6,0) node[NS,right] {$MC$};
    % line D
\draw[L]
    (0,6) -- (6,0) node[below] {$D$};
    % line MR
\draw[L, dashed]
    (0,6) -- (3.3,-0.6) node[NS,below] {$MR$};
    \end{tikzpicture}
\hfil
    \begin{tikzpicture}[scale=0.8,
    thick,
L/.style args = {#1/#2}{% L: line
    line width=#1,
    draw = #2 %color
                },
L/.default = 0.8mm/black,
 NS/.style = {%N: Node Shape
    text=black, font=\Large,}
                    ]
    % coordinates path with intersections
\coordinate (O)     at  (0,0);
    % coordinate axes
\draw[->]   (O) -- + (6.5,0)  node[right] {$Q$};
\draw[->]   (O) -- + (0,6.5)  node[above] {$P$};
    % line and fill P_2 -- Q_2
\draw[densely dotted, fill=orange!80]
    (0,3) node[left] {$P_2$} -| (3,0) node[below] {$Q_2$}
                             -| (0,3) node[NS,pos=0.25,above=1mm] {$\pi_2$};
    % line and fill P_1 -- Q_1
\fill[orange!80] (3,0) rectangle +(1.5,1.5);
\draw[densely dotted]
    (0,1.5) node[left] {$P_1$} -| (4.5,0) node[below] {$Q_1$}
                               -| (0,1.5) node[NS,pos=0.07,above=1mm] {$\pi_1$};
    % DL area
\fill[gray!30]
    (4.5,1.5) -- (6,0) -- node[NS,above=1mm] {DL} (4.5,0) -- cycle;
    % CS area
% 
% not finished
%
    % line MC
\draw[L=1mm/purple]
    (0,1) -- + (6,0) node[NS,right] {$MC$};
    % line D
\draw[L]
    (0,6) -- (6,0) node[below] {$D$};
    % line MR
\draw[L, dashed]
    (0,6) -- (3.3,-0.6) node[NS,below] {$MR$};
    \end{tikzpicture}
\end{center}
\end{document}

Optionshowframe is only for test purposes, that you can see, how images fith text width.

  • thank you for your reply. The areas are not quite like in the desired output. The areas go from the purple MC line and above. So the x-coordinates of CS and π go from zero and up till the intersection of the dashed line and the purple line. How would you make the coloring contingent on the intersections? – Saud Jul 25 '16 at 11:17

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.