\documentclass{article}
|
|
\usepackage{tikz}
|
|
|
|
\usepackage{pgfplots}
|
|
\pgfplotsset{compat=1.5.1}
|
|
|
|
\begin{document}
|
|
|
|
%1: latex as calculator
|
|
\begin{tikzpicture}
|
|
\begin{axis}
|
|
[xlabel=$x$,
|
|
ylabel=$f(x)$]
|
|
\addplot{x^2+4};
|
|
|
|
\end{axis}
|
|
\end{tikzpicture}
|
|
|
|
%2: coordinates
|
|
\begin{tikzpicture}
|
|
\begin{axis}
|
|
[xlabel=$x$,
|
|
ylabel=$f(x)$]
|
|
\addplot [color=black, mark=o, mark size=12pt]coordinates{
|
|
(0,0)
|
|
(1,2)};
|
|
\addlegendentry{Data}
|
|
\end{axis}
|
|
\end{tikzpicture}
|
|
|
|
%3: csv
|
|
\begin{tikzpicture}
|
|
\begin{axis}[
|
|
%legend style={draw =none},
|
|
legend pos = north west, % south west, south east, outer
|
|
legend columns = 2
|
|
]
|
|
\addplot table[x=time, y=voltaje, col sep=comma]{data.csv};
|
|
\addlegendentry{voltaje}
|
|
\addplot table[x=time, y=corriente, col sep=comma]{data.csv};
|
|
\addlegendentry{Corriente}
|
|
\end{axis}
|
|
\end{tikzpicture}
|
|
|
|
\end{document}
|