我怎样才能使朝左的箭头具有与 p1 和 p 之间的箭头相同的粗细、长度和颜色?然后我如何在其顶部添加数字 100?
这是我当前的代码:
\begin{center}
\begin{tikzpicture}
\begin{axis}[
scale = 1.1,
xmin = 0, xmax = 15.5,
ymin = 0, ymax = 15.5,
axis lines* = left,
xtick = {0}, ytick = \empty,
clip = false,
xlabel={$Q$ (x 1 000 000 $Cigarettes$)}, x label style={at=(current axis.right of origin), anchor=west},
ylabel={$Price$ $(HKD/Cigarette)$}, y label style={align=left, at=(current axis.above origin), anchor=south, rotate=-90},
]
% MPB line
\addplot[color = blue, very thick] coordinates {(1, 13) (13, 1)};
% MSB line
\addplot[color = blue, very thick] coordinates {(4, 15) (15, 4)};
% S line
\addplot[color = red, very thick] coordinates {(1, 1) (11.5, 11.5)};
% Snew curve
\addplot[color = red, very thick] coordinates {(0.5, 5.7) (8.5, 14.2)};
% E_1 Dashed lines
\addplot[color = black, dashed, very thick] coordinates {(0, 9.65) (9.65, 9.65)
(9.65, 0)};
% E_opt Dashed lines
\addplot[color = black, dashed, very thick] coordinates {(0, 7) (7, 7)
(7, 0)};
% e_tax Dashed lines
\addplot[color = black, dashed, very thick] coordinates {(0, 12.3) (7, 12.3)
(7, 0)};
% E_1 Coordinate point
\addplot[color = black, mark = *, only marks, mark size = 3pt]
coordinates {(9.6, 9.6)};
% E_opt Coordinate point
\addplot[color = black, mark = *, only marks, mark size = 3pt]
coordinates {(7, 7)};
% E_tax Coordinate point
\addplot[color = black, mark = *, only marks, mark size = 3pt]
coordinates {(7, 12.3)};
% Axis Labels
\draw[-{Triangle[length=3mm, width=2mm]}, blue] (1,
9.7) to (1, 12.3);
\draw [stealth-](7,1) -- (9.5,1);
% Equillibrium Labels
\node [right] at (6, 8.14) {$E_{opt}$};
\node [right] at (5.6, 13.5) {$E_{tax}$};
\node [above] at (9.5, 9.8) {$E_1$};
% Price Axis Labels
\node [left] at (0, 7.3) {$P_{opt}$};
\node [left] at (0, 12.3) {$P_1$ $\approx$ HKD $7.75$ ($\$1$)};
\node [left] at (0, 9.8) {$P$};
% Quantity Axis Labels
\node [below] at (7.3, 0) {$Q_{opt}$};
\node [below] at (9.5, 0) {$Q$};
% Line Labels
\node [right] at (12.9, 1) {$MSB$};
\node [right] at (11.5, 11.5) {$S = MPC= MSC$};
\node [right] at (8.4, 14.2) {$MPC_{+TAX}$};
\node [right] at (14.8, 4) {$D = MPB$};
\end{axis}
\end{tikzpicture}
\end{center}
\begin{center}
\caption{
\label{fig:negexter}}
Figure 2: \emph{Excise tax on cigarette consumption internalises original market failure
}
\end{center}
以下是一张供参考的图片:
答案1
对于箭头,只需使用相同的代码将其格式化为 P1 和 P 之间的箭头。P1 和 P 之间的箭头由线绘制
\draw[-{Triangle[length=3mm, width=2mm]}, blue] (1,9.7) to (1, 12.3);
因此只需采用相同的格式-{Triangle[length=3mm, width=2mm]}, blue
来绘制另一个箭头。
要在顶部添加数字 100,您可以在node[midway, above, black] {100}
绘制箭头后立即在同一路径上在箭头中间添加一个标有“100”的节点。
这是完整的例子。
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
scale = 1.1,
xmin = 0, xmax = 15.5,
ymin = 0, ymax = 15.5,
axis lines* = left,
xtick = {0}, ytick = \empty,
clip = false,
xlabel={$Q$ (x 1 000 000 $Cigarettes$)}, x label style={at=(current axis.right of origin), anchor=west},
ylabel={$Price$ $(HKD/Cigarette)$}, y label style={align=left, at=(current axis.above origin), anchor=south, rotate=-90},
]
% MPB line
\addplot[color = blue, very thick] coordinates {(1, 13) (13, 1)};
% MSB line
\addplot[color = blue, very thick] coordinates {(4, 15) (15, 4)};
% S line
\addplot[color = red, very thick] coordinates {(1, 1) (11.5, 11.5)};
% Snew curve
\addplot[color = red, very thick] coordinates {(0.5, 5.7) (8.5, 14.2)};
% E_1 Dashed lines
\addplot[color = black, dashed, very thick] coordinates {(0, 9.65) (9.65, 9.65)
(9.65, 0)};
% E_opt Dashed lines
\addplot[color = black, dashed, very thick] coordinates {(0, 7) (7, 7)
(7, 0)};
% e_tax Dashed lines
\addplot[color = black, dashed, very thick] coordinates {(0, 12.3) (7, 12.3)
(7, 0)};
% E_1 Coordinate point
\addplot[color = black, mark = *, only marks, mark size = 3pt]
coordinates {(9.6, 9.6)};
% E_opt Coordinate point
\addplot[color = black, mark = *, only marks, mark size = 3pt]
coordinates {(7, 7)};
% E_tax Coordinate point
\addplot[color = black, mark = *, only marks, mark size = 3pt]
coordinates {(7, 12.3)};
% Axis Labels
\draw[-{Triangle[length=3mm, width=2mm]}, blue] (1,9.7) to (1, 12.3);
\draw[-{Triangle[length=3mm, width=2mm]}, blue] (9.5,1) -- (7,1) node[midway, above, black] {100};
% Equillibrium Labels
\node [right] at (6, 8.14) {$E_{opt}$};
\node [right] at (5.6, 13.5) {$E_{tax}$};
\node [above] at (9.5, 9.8) {$E_1$};
% Price Axis Labels
\node [left] at (0, 7.3) {$P_{opt}$};
\node [left] at (0, 12.3) {$P_1$ $\approx$ HKD $7.75$ ($\$1$)};
\node [left] at (0, 9.8) {$P$};
% Quantity Axis Labels
\node [below] at (7.3, 0) {$Q_{opt}$};
\node [below] at (9.5, 0) {$Q$};
% Line Labels
\node [right] at (12.9, 1) {$MSB$};
\node [right] at (11.5, 11.5) {$S = MPC= MSC$};
\node [right] at (8.4, 14.2) {$MPC_{+TAX}$};
\node [right] at (14.8, 4) {$D = MPB$};
\end{axis}
\end{tikzpicture}
\end{document}