为了制作盖-吕萨克定律的图形,我制作了此图形。我设法绘制了测量点,但与之对应的函数(我用 TI-nspire 绘制)绘制不正确。与 - 轴的交点y
太低。它应该在 97。
\documentclass{beamer}
\usepackage{tikz,tkz-base, pgf,tkz-euclide}
\usetikzlibrary{arrows, calc,intersections,through,backgrounds,snakes, decorations.pathmorphing}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\begin{axis}[%
title= Gay-Lussac,
major grid style=gray,
axis lines=center,
ymin=85,
ymax=125,
axis y discontinuity=crunch,
xmin=0, xmax=40,
xtick={0,5,...,40},
ytick={0,5,...,125},
width=\textwidth,
height=8cm,
xlabel={\tiny V (ml)},
ylabel={\tiny p (kPa)},
%ticks=both,
minor xtick={0,5,...,40},
minor ytick={0,5,...,125},
grid=both,
enlarge x limits={upper},
enlarge y limits={upper},
]
\draw[color=blue, very thick, samples=80, domain=0:410] plot (\x,0.357355263*\x + 97) node[above] {{\scriptsize $V_1$}};
\addplot[color = black, fill = black, mark = *, only marks]
coordinates{(20.016,103.19) (23.709,104.49) (24.707,105.06) (26.6,105.7) (27.8,106.2) (28.7,106.5) (30.4,107.2) (32.4,107.7) (34.6,108.5) (36.8,109.2) (38.2,109.5)};
\end{axis}
\end{tikzpicture}
\end{frame}
\end{document}
答案1
使用
\addplot[color=blue, very thick, samples=80, domain=0:410] {0.357355263*x + 97}
node[above] {{\scriptsize $V_1$}};
代替
\draw[color=blue, very thick, samples=80, domain=0:410]
plot (\x,0.357355263*\x + 97) node[above] {{\scriptsize $V_1$}};
因为无论如何你都在使用pgfplots
。
\documentclass{beamer}
\usepackage{tikz,tkz-base, pgf,tkz-euclide}
\usetikzlibrary{arrows, calc,intersections,through,backgrounds,snakes, decorations.pathmorphing}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\begin{axis}[%
title= Gay-Lussac,
major grid style=gray,
axis lines=center,
ymin=85,
ymax=125,
axis y discontinuity=crunch,
xmin=0, xmax=40,
xtick={0,5,...,40},
ytick={0,5,...,125},
width=\textwidth,
height=8cm,
xlabel={\tiny V (ml)},
ylabel={\tiny p (kPa)},
%ticks=both,
minor xtick={0,5,...,40},
minor ytick={0,5,...,125},
grid=both,
enlarge x limits={upper},
enlarge y limits={upper},
]
\addplot[color=blue, very thick, samples=80, domain=0:410] {0.357355263*x + 97} node[above] {{\scriptsize $V_1$}};
\addplot[color = black, fill = black, mark = *, only marks]
coordinates{(20.016,103.19) (23.709,104.49) (24.707,105.06) (26.6,105.7) (27.8,106.2) (28.7,106.5) (30.4,107.2) (32.4,107.7) (34.6,108.5) (36.8,109.2) (38.2,109.5)};
\end{axis}
\end{tikzpicture}
\end{frame}
\end{document}