我想连接两个如下所示的图形。
我已经拥有的代码是:
\documentclass{article}
\usepackage[english]{babel}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{tkz-tab}
\usepackage{cancel}
\usepackage{forest}
\usepackage{caption}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{paralist}
\usepackage{pst-tree,array}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{epstopdf}
\usepackage{rotating}
\usepackage[usenames,dvipsnames]{xcolor}
\usetikzlibrary{arrows}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}[scale=.6,>=latex,font=\footnotesize,domain=0:7]
\draw[thick, -] (4.5,3.5)--(7,8) node[above right]{$S$};
\draw[dashed] (4.5,3.5)--(0,3.5) node[left]{$P_{\min}$};
\draw[very thick, <->](0,8)node[left]{$P$}--(0,0)--(8,0)node[below]{$Q$};
\begin{scope}[yshift=10cm,domain=1:7]
%AVC
\draw[thick,yscale=.6,name path global=avc] plot (\x,{.2*\x^2-1.8*\x+6})
node[right]{$AVC$};
%MC
\draw[red,thick,yscale=.6,name path global=mc] plot (\x,{.6*\x^2-3.6*\x+6})
node[right]{$MC$};
\draw[very thick, <->](0,8)node[left]{$C$}--(0,0)--(8,0)node[below]{$Q$};
\end{scope}
\draw[name intersections={of=mc and avc, by=mypoint},dashed](mypoint)--(mypoint|-0,0) node[below]{$Q_{\min}$};
\end{tikzpicture}
\end{document}
我想要将一个图形放在另一个图形旁边。我该如何添加钩子以显示供给曲线的来源以及 AVC=MC 点处的箭头?
答案1
这里建议使用 decorations.pathreplacing 库来处理大括号:
\documentclass[margin=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{
arrows,
intersections,
decorations.pathreplacing
}
\begin{document}
\begin{tikzpicture}[
scale=.6,
>=latex,
font=\footnotesize,
domain=1:7,
decoration={brace,amplitude=10pt}
]
\def\myshift{10}% shift of the right diagram
\foreach \x/\ylabel in {0/C,\myshift/P}
\draw[very thick, <->](\x,8)node[left]{$\ylabel$}--(\x,0)--(\x+8,0)node[below]{$Q$};
%AVC
\draw[thick,yscale=.6,name path global=avc,green!50!black] plot (\x,{.2*\x^2-1.8*\x+6})
node[right]{$AVC$};
%MC
\draw[blue,thick,yscale=.6,name path global=mc] plot (\x,{.6*\x^2-3.6*\x+6})
node[above right]{$MC$}coordinate(mc1);
%intersection AVC and MC
\path[name intersections={of=mc and avc, by=mp1},dashed,thick];
%shutdown point
\draw[<-](mp1)--+(-45:1)node[right,align=left,font=\tiny]{SHUTDOWN\\POINT};
%dashed lines
\foreach \p in {mc,mp}
\draw[dashed](\p1)--+(\myshift,0)coordinate(\p2);
\foreach \i in {1,2}
\draw[dashed,thick](mp\i)--(mp\i|-0,0) node[below]{$Q_{\min}$};
%brace
\draw[decorate](mp1)--node[above left,align=left,font=\tiny,outer xsep=3mm]{SUPPLY\\CURVE}(mc1);
%lila arrow
\draw[blue!50!red,->,thick,shorten >=1mm,shorten <=1mm]([xshift=5mm]mp1)--([xshift=5mm]mc1);
%red line
\draw[red,thick](mp2)--(mc2)node[below right]{$S$};
\end{tikzpicture}
\end{document}