From 0c311dcf5e433ac18d52ef3a4b061abe00ee7b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerardo=20Marx=20Cha=CC=81vez-Campos?= Date: Tue, 18 Apr 2023 08:41:07 -0600 Subject: [PATCH] examples for pgfplots --- coordinates.tex | 33 +++++++++++++++++++++++++++++++++ data.csv | 9 +++++++++ equations.tex | 34 ++++++++++++++++++++++++++++++++++ scheme.tex | 30 ++++++++++++++++++++++++++++++ table.tex | 12 ++++++++++++ 5 files changed, 118 insertions(+) create mode 100644 coordinates.tex create mode 100644 data.csv create mode 100644 equations.tex create mode 100644 scheme.tex create mode 100644 table.tex diff --git a/coordinates.tex b/coordinates.tex new file mode 100644 index 0000000..a4792c2 --- /dev/null +++ b/coordinates.tex @@ -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} \ No newline at end of file diff --git a/data.csv b/data.csv new file mode 100644 index 0000000..85164c2 --- /dev/null +++ b/data.csv @@ -0,0 +1,9 @@ +col1 col2 +1 2 +2 4 +3 9 +4 16 +5 25 +6 36 +7 49 + diff --git a/equations.tex b/equations.tex new file mode 100644 index 0000000..c4e875a --- /dev/null +++ b/equations.tex @@ -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} \ No newline at end of file diff --git a/scheme.tex b/scheme.tex new file mode 100644 index 0000000..b448522 --- /dev/null +++ b/scheme.tex @@ -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} \ No newline at end of file diff --git a/table.tex b/table.tex new file mode 100644 index 0000000..e5c2953 --- /dev/null +++ b/table.tex @@ -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}