4

In an attempt to make a graphic of Gay-Lussacs Law, I made this graphic. I've managed to draw the measure points, but the function corresponding with it (which I did with my TI-nspire) is not drawing correctly. The intersection point with the y-axis is too low. It should be at 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}

enter image description here

3

Use

\addplot[color=blue, very thick, samples=80, domain=0:410]   {0.357355263*x + 97}
             node[above] {{\scriptsize  $V_1$}};

instead of

\draw[color=blue, very thick, samples=80, domain=0:410]    
                plot (\x,0.357355263*\x + 97)     node[above] {{\scriptsize  $V_1$}};

since you are using pgfplots anyway.

\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}

enter image description here

  • Thanks for your answer. I used this option because I couldn't put a node to it, but that you answered also. :) But it is still strange it doesn't draw the correct function. – Arne Timperman Jan 18 '15 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.