隐藏 pgplot 中的一条线

隐藏 pgplot 中的一条线

下午好,我很想将勾勒出绿色梯形面积的垂直线改为虚线而不是实线...不幸的是,我对 pfgplot 还很陌生,我真的不知道该怎么做...基本上,似乎 LaTeX 正在“绘制两次”虚线,这样它们就并列了一点...我也想翻转 yaxis 标签并将其放在轴的顶部...

在此处输入图片描述

\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
compat=newest,
axis lines = left,
xlabel = {$\text{A\&D} / 100k$},
ylabel = {$gp$},
xmin = 0,
ymin = 0,
xmax = 60,
ymax = 730,
xtick={0,20},
ytick={40+20/3,160+20/3,560+20/3},
title = {Locals, Peak},
]
\addplot[
domain = 0:75,
samples = 190,
thick,
]
{560 + 20/3 - 20*x};
\draw [dotted] (0,160+20/3) -- (20,160+20/3) -- (20,0);
\draw [dotted] (0,40+20/3) -- (26, 40 + 20/3) -- (26,0);
\draw [pattern = north east lines, pattern color = green](0, 40 + 20/3) -- (0,560 + 20/3) -- (20, 160 + 2/3) -- (20, 40 + 2/3);
\end{axis}
\end{tikzpicture}
\end{document}

相关内容