如何在一个图表上绘制多个函数并在它们的交点处放置一个粗体点?我想在下面创建的图表中添加一个 x^3 并在 (1,1) 处放置一个粗体点。
\documentclass{article}
\RequirePackage{pgfplots}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[scale=3]
\shade[top color=red,bottom color=gray!50] (0,0) parabola (1.5,2.25) |- (0,0);
\draw[help lines] (0,0) grid (3.9,3.9) [step=0.25cm];
\draw[->] (-0.2,0) -- (4,0) node[right] {$x$};
\draw[->] (0,-0.2) -- (0,4) node[above] {$f(x)$};
\foreach \x/\xtext in {1/1, 1.5/1\frac{1}{2}, 2/2, 3/3}
\draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$};
\foreach \y/\ytext in {1/1, 2/2, 2.25/2\frac{1}{4}, 3/3}
\draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
\draw (-.5,.25) parabola bend (0,0) (2,4) node[below right] {$x^2$};
\draw (-.5,.25) parabola bend (0,0) (2,4) node[below right] {$x^3$};
\end{tikzpicture}
\end{document}
答案1
我有点困惑,因为你正在加载 pgfplots 包,但用“普通”Ti 绘制图片钾Z. 因此我的答案基于简单的 Ti钾Z。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}[scale=3]
\shade[top color=red,bottom color=gray!50] (0,0) parabola (1.5,2.25) |- (0,0);
\draw[help lines] (0,0) grid (3.9,3.9) [step=0.25cm];
\draw[->] (-0.2,0) -- (4,0) node[right] {$x$};
\draw[->] (0,-0.2) -- (0,4) node[above] {$f(x)$};
\foreach \x/\xtext in {1/1, 1.5/1\frac{1}{2}, 2/2, 3/3}
\draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$};
\foreach \y/\ytext in {1/1, 2/2, 2.25/2\frac{1}{4}, 3/3}
\draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
\draw[name path=parabola] (-.5,.25) parabola bend (0,0) (2,4) node[below right] {$x^2$};
\draw[name path=cubic] plot[variable=\x,domain=-0.5:1.6] ({\x},{\x^3}) node[below right] {$x^3$};
\fill[blue] [name intersections={of={parabola} and {cubic}}]
(intersection-1) circle (2pt);
\end{tikzpicture}
\end{document}
由于某种原因,它在这里只找到一个交叉点,但那就是您提到的那个。