
我想用 Tikz/PGFplots 繪製以下內容:
X = 0:12。 Y = 0:30。
\documentclass[10pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usepackage{float}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{ududff}{rgb}{0.30196078431372547,0.30196078431372547,1}
\definecolor{qqqqff}{rgb}{0,0,1}
\definecolor{qqwuqq}{rgb}{0,0.39215686274509803,0}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{axis}[%
domain=0:30,
xmin=0, xmax=30,
ymin=0, ymax=12,
smooth,
axis lines = left]
\addplot[red] {1/25000*pow(x,4)-3/2500*pow(x,3)-3/200*pow(x,2)+1/2*x+7} node[above]{$f$};
\addplot[black] {1/50000*pow(x,4)-11/5000*pow(x,3)+29/400*pow(x,2)-3/4*x+7} node[below]{$g$};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
需要補充的是:B點和C點:
如果可能的話:刪除箭頭上的線+在兩個軸上方加上x和y。 $f$ 和 $g$ 需要以某種方式替換(實際上希望它們位於曲線上方。
我希望你能幫忙。
答案1
您可以使用標記新增另一個座標圖,point meta=explicit symbolic
並nodes near coords
新增「自訂」標籤來取得:
這是修改後的 MWE:
\documentclass[10pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{float}
\pagestyle{empty}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{axis}[%
domain=0:30,
xmin=0, xmax=33,
ymin=0, ymax=12,
smooth,
axis lines = left,
]
\addplot[green] {1/25000*pow(x,4)-3/2500*pow(x,3)-3/200*pow(x,2)+1/2*x+7} node[above]{$f$};
\addplot[blue] {1/50000*pow(x,4)-11/5000*pow(x,3)+29/400*pow(x,2)-3/4*x+7} node[below]{$g$};
\addplot [
only marks,
mark=ball,
mark size=2pt,
point meta=explicit symbolic,
nodes near coords
] coordinates {
(10, 19/4) [B]
(25, 7) [C]
};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}