Add Makefile & more examples
This commit is contained in:
88
examples/colorschemes.tex
Normal file
88
examples/colorschemes.tex
Normal file
@@ -0,0 +1,88 @@
|
||||
\documentclass{article}
|
||||
|
||||
% Packages necessary for common.tex
|
||||
\usepackage{amsmath}
|
||||
\usepackage{pgfplots}
|
||||
\pgfplotsset{compat=newest}
|
||||
|
||||
% Other packages
|
||||
\usepackage{float}
|
||||
\usepackage{subcaption}
|
||||
\usepackage[a4paper, total={5in, 9in}]{geometry}
|
||||
\usetikzlibrary{positioning}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%%%%% Set common options %%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
\input{common.tex}
|
||||
\pgfplotsset{colorscheme/cel}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%%%%%% Actual Document %%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
\begin{document}
|
||||
|
||||
|
||||
\foreach \x in {cel, rocket, viridis, mako, cividis}{
|
||||
\pgfplotsset{colorscheme/\x}
|
||||
|
||||
\colorbox{gray!30}{\texttt{colorscheme/\x}}
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
|
||||
\tikzstyle{colornode} = [draw, inner sep=0pt, minimum width=1cm, minimum height=0.5cm]
|
||||
\pgfplotsset{scaled y ticks=false}
|
||||
|
||||
\begin{subfigure}[c]{0.45\textwidth}
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
domain=0:10,
|
||||
view={0}{90},
|
||||
yticklabel=\empty,xticklabel=\empty,
|
||||
width=\textwidth,
|
||||
height=0.75\textwidth,
|
||||
]
|
||||
\addplot3+[surf]
|
||||
{x + y};
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
\end{subfigure}%
|
||||
\begin{subfigure}[c]{0.45\textwidth}
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
domain=0:10,
|
||||
ymin=-1e4,ymax=1,
|
||||
legend pos=south west,
|
||||
yticklabel=\empty,xticklabel=\empty,
|
||||
width=\textwidth,
|
||||
height=0.75\textwidth,
|
||||
]
|
||||
\foreach \i in {1,2,4,8}{
|
||||
\addplot+ [mark=none, line width=1pt]
|
||||
{-\i*exp(x)};
|
||||
%\expandafter\addlegendentry\expandafter{$e^{-\text{\i} x}$}
|
||||
\addlegendentryexpanded{$e^{-\i x}$}
|
||||
}
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
\end{subfigure}%
|
||||
\begin{subfigure}[c]{0.1\textwidth}
|
||||
\begin{tikzpicture}
|
||||
\node[colornode, fill=scol3] (color3) {};
|
||||
\node[colornode, fill=scol2, above=1mm of color3] (color2) {};
|
||||
\node[colornode, fill=scol1, above=1mm of color2] (color1) {};
|
||||
\node[colornode, fill=scol0, above=1mm of color1] (color0) {};
|
||||
\end{tikzpicture}
|
||||
\end{subfigure}%
|
||||
\end{figure}
|
||||
}
|
||||
|
||||
|
||||
\end{document}
|
||||
|
||||
177
examples/csv_manipulation.tex
Normal file
177
examples/csv_manipulation.tex
Normal file
@@ -0,0 +1,177 @@
|
||||
\documentclass{article}
|
||||
|
||||
% Packages necessary for common.tex
|
||||
\usepackage{amsmath}
|
||||
\usepackage{pgfplots}
|
||||
\pgfplotsset{compat=newest}
|
||||
|
||||
% Other packages
|
||||
\usepackage{float}
|
||||
\usepackage{subcaption}
|
||||
\usepackage[a4paper, total={6.5in, 9in}]{geometry}
|
||||
\usetikzlibrary{positioning}
|
||||
\usepackage{ifthen}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%%%%% Set common options %%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
\input{common.tex}
|
||||
\pgfplotsset{colorscheme/rocket}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%%%%%% Actual Document %%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
\title{Manipulation of CSV data}
|
||||
\author{}
|
||||
\date{}
|
||||
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% 'discard if lt' & 'discard if gt'
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
|
||||
\begin{subfigure}[t]{0.49\textwidth}
|
||||
|
||||
%%%%%%%%%%%%%%%%%
|
||||
% Crop along x axis
|
||||
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
width=\textwidth,
|
||||
height=0.55\textwidth,
|
||||
xmin=-5, xmax=132,
|
||||
ymin=-3, ymax=6,
|
||||
]
|
||||
% Plot all data as reference
|
||||
\addplot+[mark=none, line width=1pt]
|
||||
table[col sep=comma, x=x, y=y]
|
||||
{res/random.csv};
|
||||
\addlegendentry{All data}
|
||||
|
||||
% Crop and plot desired data
|
||||
\addplot+[scol2, mark=none, line width=1pt]
|
||||
table[col sep=comma, x=x, y=y, discard if lt={x}{40},
|
||||
discard if gt={x}{80}]
|
||||
{res/random.csv};
|
||||
\addlegendentry{Cropped data}
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
|
||||
\caption{\texttt{discard if lt/gt} used to crop along $x$-axis}
|
||||
\end{subfigure}%
|
||||
\hfill%
|
||||
\begin{subfigure}[t]{0.49\textwidth}
|
||||
|
||||
%%%%%%%%%%%%%%%%%
|
||||
% Crop along y axis
|
||||
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
width=\textwidth,
|
||||
height=0.55\textwidth,
|
||||
xmin=-5, xmax=132,
|
||||
ymin=-3, ymax=6,
|
||||
]
|
||||
% Plot all data as reference
|
||||
\addplot+[mark=*]
|
||||
table[col sep=comma, x=x, y=y]
|
||||
{res/random.csv};
|
||||
\addlegendentry{All data}
|
||||
|
||||
% Crop and plot desired data
|
||||
\addplot+[scol2, only marks]
|
||||
table[col sep=comma, x=x, y=y, discard if gt={y}{1},
|
||||
discard if lt={y}{-1}]
|
||||
{res/random.csv};
|
||||
\addlegendentry{Cropped data}
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
|
||||
\caption{\texttt{discard if lt/gt} used to crop along $y$-axis}
|
||||
\end{subfigure}
|
||||
|
||||
\caption{\texttt{discard if lt} and \texttt{discard if gt}}
|
||||
\end{figure}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% 'discard if' & 'discard if not'
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
|
||||
\begin{subfigure}[t]{0.49\textwidth}
|
||||
|
||||
%%%%%%%%%%%%%%%%%
|
||||
% Select single datastream
|
||||
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
width=\textwidth,
|
||||
height=0.5\textwidth,
|
||||
ymin=-4,ymax=14,
|
||||
]
|
||||
% Plot all data as reference
|
||||
\foreach \i in {0.0, 3.0, 6.0, 9.0} {
|
||||
\addplot[scol0!20, mark=none, line width=1pt, forget plot]
|
||||
table[col sep=comma, x=x, y=y, discard if not={mu}{\i}]
|
||||
{res/random_multiple.csv};
|
||||
}
|
||||
\addlegendimage{scol0!20, mark=none, line width=1pt, forget plot}
|
||||
\addlegendentry{All data}
|
||||
|
||||
% Select and plot desired datastream
|
||||
\addplot+[scol2, mark=none, line width=1pt]
|
||||
table[col sep=comma, x=x, y=y, discard if not={mu}{3.0}]
|
||||
{res/random_multiple.csv};
|
||||
\addlegendentry{$\mu=3.0$}
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
|
||||
\caption{\texttt{discard if not} used to select single datastream}
|
||||
\end{subfigure}%
|
||||
\begin{subfigure}[t]{0.49\textwidth}
|
||||
|
||||
%%%%%%%%%%%%%%%%%
|
||||
% Discard single datastream
|
||||
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
width=\textwidth,
|
||||
height=0.5\textwidth,
|
||||
ymin=-4,ymax=14,
|
||||
]
|
||||
% Plot all data as reference
|
||||
\addplot+[scol0!20, only marks, point meta=\thisrow{mu}]
|
||||
table[col sep=comma, x=x, y=y]
|
||||
{res/random_multiple.csv};
|
||||
\addlegendentry{All data}
|
||||
|
||||
% Discard datastream and plot desired data
|
||||
\addplot+[scol1, only marks, point meta=\thisrow{mu}]
|
||||
table[col sep=comma, x=x, y=y, discard if={mu}{6.0}]
|
||||
{res/random_multiple.csv};
|
||||
\addlegendentry{All except discarded}
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
|
||||
\caption{\texttt{discard if} used to discard single datastream}
|
||||
\end{subfigure}
|
||||
|
||||
\caption{\texttt{discard if} and \texttt{discard if not}}
|
||||
\end{figure}
|
||||
|
||||
|
||||
\end{document}
|
||||
|
||||
Reference in New Issue
Block a user