Browse Source

examples for pgfplots

main
commit
0c311dcf5e
5 changed files with 118 additions and 0 deletions
  1. +33
    -0
      coordinates.tex
  2. +9
    -0
      data.csv
  3. +34
    -0
      equations.tex
  4. +30
    -0
      scheme.tex
  5. +12
    -0
      table.tex

+ 33
- 0
coordinates.tex View File

@ -0,0 +1,33 @@
\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\usepackage{siunitx}
\pgfplotsset{width=10cm, compat=1.9}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
title={Temperature dependence of $5H_2O$},
xlabel={Temperature [$\unit{\degreeCelsius}$]},
xmin=0,
xtick={0,20,40, 60, 80,100},
ylabel={Solubility},
xmajorgrids=true,
grid style=dashed,
legend pos=north west
]
\addplot coordinates{
(0,23.1)
(10,27.1)
(20,32)
(30,37.8)
(40,44.6)
(60,61.8)
(80,83.8)
(100, 114)
};
\legend{$5H_2O$}
\end{axis}
\end{tikzpicture}
\end{document}

+ 9
- 0
data.csv View File

@ -0,0 +1,9 @@
col1 col2
1 2
2 4
3 9
4 16
5 25
6 36
7 49

+ 34
- 0
equations.tex View File

@ -0,0 +1,34 @@
\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=10cm, compat=1.9}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
%axis lines=both,
xlabel=$x$,
ylabel=$f(x)$
]
\addplot[
color=red,
domain=-10:10,
samples=10,
mark=*
]{x^2-2*x-1};
\addlegendentry{$x^2-2x-1$}
\addplot[
color=blue,
domain=-10:10,
samples=10,
mark=square %pentagon%square
]{x^2+2*x-1};
\addlegendentry{$x^2+2x-1$}
\end{axis}
\end{tikzpicture}
\end{document}

+ 30
- 0
scheme.tex View File

@ -0,0 +1,30 @@
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,shadows,arrows}
\tikzstyle{startnode} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=gray!50]
\tikzstyle{corenode} = [rectangle, rounded corners, minimum width=3cm, minimum
height=1cm, text centered, draw=black, fill=gray!10]
\tikzstyle{endnode} = [diamond, rounded corners, minimum height=1cm, text centered, draw=black, fill=red!30]
\tikzstyle{endnode2} = [diamond, text centered, draw=black, fill=red!30]
\begin{document}
\begin{tikzpicture}[node distance=2cm]
%create all of the nodes
\node (start) [startnode] {Start};
\node (step1) [corenode, below of=start] {Step 1};
\node (in) [corenode, right of=start, node distance=5cm] {In};
\node (end)[endnode2, below of =step1]{End};
\node (out) [below of=end, node distance=2cm] {out};
\draw[->] (start) -- (step1);
\draw[->] (step1) -- (end);
\draw[->] (in) |- (step1);
\draw [->] (end) -- (out);
\end{tikzpicture}
\end{document}

+ 12
- 0
table.tex View File

@ -0,0 +1,12 @@
\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\usepackage{siunitx}
\pgfplotsset{width=10cm, compat=1.9}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot table[x=col1,y=col2]{data.csv};
\end{axis}
\end{tikzpicture}
\end{document}

Loading…
Cancel
Save