我有一张几乎完全符合我想要的图表,但我不知道如何进行调整以使其完美。
以下是我现在拥有的:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{width = 12cm, compat = newest}
\usepackage{sansmath}
\usepgflibrary{shapes.geometric}
\pgfplotsset{my style/.append style={axis x line=left, axis y line=
left, xlabel=x, ylabel=y}} % the middle would produce the axis with four quadrants, and the left or right would result in only one quadrant.
\begin{document}
\begin{tikzpicture}
\begin{axis}[my style]
\addplot[domain=0:10] {x^2} node[pos=0.9,left]{$C_2x^2$}; % the domain signifies the range for the graph
\addplot[domain=0:10] {7*x^2} node[pos=0.9,left]{$C_1x^2$};
\addplot[domain=0:10]{(5*x^2)+2*x} node[pos=0.9,left]{$f(x)$};
\end{axis}
\end{tikzpicture}
\end{document}
我想调整$C_{2}x^2$
标签的位置,使其略高于图表,而不是在图表上。我还需要完全删除轴上的数字,并在 x 轴上标记一个点,标记$k=1$
为$x=1$
。
答案1
像这样?
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{width=12cm, compat=newest,
my style/.append style={
axis x line=left,
axis y line=left,
xlabel=x,
ylabel=y,
yticklabels={},
xtick={1},
xticklabels={$k=1$}}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[my style]
\addplot[domain=0:10] {x^2} node[pos=0.9,above left]{$C_2x^2$};
\addplot[domain=0:10] {7*x^2} node[pos=0.9,above left]{$C_1x^2$};
\addplot[domain=0:10] {(5*x^2)+2*x} node[pos=0.9,above left]{$f(x)$};
\end{axis}
\end{tikzpicture}
\end{document}