我试图重复这图表,但只是其中的一部分。我的目标是让 TP 曲线在最后更向下。此外,我发现很难在那里画虚线。有办法解决这个问题吗?
一些可能有效的方程式:
TP:Q=21x+9x^2-x^3 AP:Q=21+9x-x^2 MP:21+18x-3x^2
代码:
\documentclass{standalone}
\usepackage[english,greek]{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{pst-node}
\def\obj#1{\makebox[1cm]{\strut#1}}
\usepackage{pdflscape}
\usepackage{paralist}
\usepackage{pst-tree,array}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{rotating}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{chngcntr}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{wrapfig}
\usepackage{color}
\usepackage[explicit]{titlesec}
\usepackage{appendix}
\usepackage{etoolbox}
\usepackage{type1cm}
\usepackage{lettrine}
\usepackage[stable]{footmisc}
\usepackage{multicol}
\usepackage{chngcntr}
\usepackage{url}
\usepackage{marvosym}
\usepackage{tcolorbox}
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}
\usepackage{hyperref}
\tcbuselibrary{theorems}
\usepackage{tkz-euclide}
\usetikzlibrary{shapes.geometric}
\usepackage{tkz-fct} \usetkzobj{all}
\usetikzlibrary{calc,decorations.pathreplacing}
\usetikzlibrary{decorations.markings}
\usepackage{pgfplots}
\usepackage{verbatim}
\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}[scale=.8,>=latex,font=\footnotesize,domain=0:7]
\begin{scope}
\begin{scope}[yscale=-1,rotate=-90]
\draw[Red,thick,yscale=.25] plot (\x,{.2*\x^3-1.8*\x^2+6*\x})
node[above right]{$TP$};
\end{scope}
\begin{scope}[domain=1:6, rotate=0]
\draw[Green,thick,yscale=.6,name path global=MP] plot (\x,{-.6*\x^2+3.6*\x-1.5})
node[right]{$MP$};
\draw[Blue, thick,yscale=.6,name path global=AP] plot (\x,{-.2*\x^2+1.8*\x-.1})
node[right]{$AP$};
\end{scope}
\draw[very thick, <->](0,8)node[left]{$Q$}--(0,0)--(8,0)node[below]{$L$};
\end{scope}
\draw[name intersections={of=AP and MP, by=mypoint},dashed](mypoint)--(mypoint|-0,0);
\end{tikzpicture}
\end{document}
答案1
- 有用的线条被埋在许多无用的线条之中
- (也许由于这个原因)数学和之间的联系
tikz
已经消失了。
无论如何,在清理你的代码后,我改变了TP函数变成正确的函数,添加虚线,并添加标签,连接最大值和零点议员。
代码
\documentclass[11pt, margin=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}[scale=1, domain=0:7, every node/.style={scale=.8},
points to/.style={thin, arrows={->[length=.5ex]},
black!40, shorten >=5pt, shorten <=5pt},
y={(0, .3 cm)}, samples=150]
\draw[very thin, <->] (0, 20) node[left] {$Q$} -- (0, 0)
-- (8, 0) node[below] {$L$};
\draw[red, thick, name path=TP] plot (\x, {-.2*\x^3+1.8*\x^2})
node[right]{$TP$};
\draw[green!50!black, thick, name path=MP]
plot (\x, {-.6*\x^2+3.6*\x}) node[right]{$MP$};
\draw[blue, thick, name path=AP]
plot (\x, {-.2*\x^2+1.8*\x-.01}) node[right]{$AP$}; % needed for the point $I$
\draw[name intersections={of=AP and MP, by=I}, dashed, very thin]
(I) -- (I|-0, 0);
\draw[dashed, very thin] (6, 0) node (MP=0){}
-- ++(0, {-.2*6^3+1.8*6^2}) node (TPmax) {};
\path (7, 10) node[right] (label) {$TP$ max when $MP=0$}
edge[out=-90, in=15, points to] (MP=0) edge[out=85, in=-70, points to] (TPmax);
\end{tikzpicture}
\end{document}