Compare commits

..

6 Commits

7 changed files with 157 additions and 86 deletions

View File

@@ -1,11 +1,11 @@
SRCS=$(shell find examples -type f -name "*.tex")
PDFS=$(shell echo $(SRCS:.tex=.pdf) | sed -e "s/examples\\///g")
all: $(PDFS)
%.pdf: examples/%.tex
latexmk $<
all: $(PDFS)
clean:
rm -rf build

View File

@@ -26,7 +26,7 @@ $ make
```bash
$ docker build -f dockerfiles/Dockerfile.alpine . -t latex-common
```
2. Build example
2. Build examples
```bash
$ docker run --rm -v $PWD:$PWD -w $PWD -u `id -u`:`id -g` latex-common make
```

View File

@@ -5,7 +5,6 @@
% ||====================================================================||
% || WARNING ||
% ||====================================================================||
% || ||
% || The following packages have to be included before using this file: ||
% || amsmath ||
% || pgfplots ||
@@ -23,7 +22,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Graphics & Plotting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Data Manipulation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -72,21 +71,17 @@
}
}
%
% Styles
%
\pgfplotsset{
fancy marks/.style={
% TODO
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Graphics & Plotting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Colors
%
% KIT Colors
\definecolor{kit-green100}{rgb}{0,.59,.51}
\definecolor{kit-green70}{rgb}{.3,.71,.65}
\definecolor{kit-green50}{rgb}{.50,.79,.75}
@@ -143,6 +138,19 @@
\colorlet{kit-cyanblue30}{KITcyanblue!30}
\colorlet{kit-cyanblue15}{KITcyanblue!15}
% Matplotlib Colors
\definecolor{Mpl1}{HTML}{1f77b4}
\definecolor{Mpl2}{HTML}{ff7f0e}
\definecolor{Mpl3}{HTML}{2ca02c}
\definecolor{Mpl4}{HTML}{d62728}
\definecolor{Mpl5}{HTML}{9467bd}
\definecolor{Mpl6}{HTML}{8c564b}
\definecolor{Mpl7}{HTML}{e377c2}
\definecolor{Mpl8}{HTML}{7f7f7f}
\definecolor{Mpl9}{HTML}{bcbd22}
\definecolor{Mpl10}{HTML}{17becf}
%
% Color Schemes
%
@@ -180,6 +188,42 @@
color=(kit-green70);
color=(kit-yellow70!80!kit-orange70);
},
colormap={matplotlib}{
% Source: https://github.com/matplotlib/matplotlib/blob/e5a85f960b2d47eac371cff709b830d52c36d267/lib/matplotlib/_cm.py#L1114
rgb=(0.2298057, 0.298717966, 0.753683153)
rgb=(0.26623388, 0.353094838, 0.801466763)
rgb=(0.30386891, 0.406535296, 0.84495867 )
rgb=(0.342804478, 0.458757618, 0.883725899)
rgb=(0.38301334, 0.50941904, 0.917387822)
rgb=(0.424369608, 0.558148092, 0.945619588)
rgb=(0.46666708, 0.604562568, 0.968154911)
rgb=(0.509635204, 0.648280772, 0.98478814 )
rgb=(0.552953156, 0.688929332, 0.995375608)
rgb=(0.596262162, 0.726149107, 0.999836203)
rgb=(0.639176211, 0.759599947, 0.998151185)
rgb=(0.681291281, 0.788964712, 0.990363227)
rgb=(0.722193294, 0.813952739, 0.976574709)
rgb=(0.761464949, 0.834302879, 0.956945269)
rgb=(0.798691636, 0.849786142, 0.931688648)
rgb=(0.833466556, 0.860207984, 0.901068838)
rgb=(0.865395197, 0.86541021, 0.865395561)
rgb=(0.897787179, 0.848937047, 0.820880546)
rgb=(0.924127593, 0.827384882, 0.774508472)
rgb=(0.944468518, 0.800927443, 0.726736146)
rgb=(0.958852946, 0.769767752, 0.678007945)
rgb=(0.96732803, 0.734132809, 0.628751763)
rgb=(0.969954137, 0.694266682, 0.579375448)
rgb=(0.966811177, 0.650421156, 0.530263762)
rgb=(0.958003065, 0.602842431, 0.481775914)
rgb=(0.943660866, 0.551750968, 0.434243684)
rgb=(0.923944917, 0.49730856, 0.387970225)
rgb=(0.89904617, 0.439559467, 0.343229596)
rgb=(0.869186849, 0.378313092, 0.300267182)
rgb=(0.834620542, 0.312874446, 0.259301199)
rgb=(0.795631745, 0.24128379, 0.220525627)
rgb=(0.752534934, 0.157246067, 0.184115123)
rgb=(0.705673158, 0.01555616, 0.150232812)
}
}
% Define cycle lists
@@ -199,8 +243,11 @@
\pgfplotscreateplotcyclelist{cel}{%
[samples of colormap={4} of cel]%
}
\pgfplotscreateplotcyclelist{matplotlib}{%
{Mpl1},{Mpl2},{Mpl3},{Mpl4}
}
% Define individual colors
% Define 'scolX' colors
\makeatletter
@@ -219,40 +266,52 @@
\makeatother
\def\setschemecolors{
\def\setschemecolorsfrommap{
\extractcolormapcolor{scol0}{0}
\extractcolormapcolor{scol1}{333}
\extractcolormapcolor{scol2}{666}
\extractcolormapcolor{scol3}{1000}
}
\newcommand{\setschemecolorsmanually}[4]{
\colorlet{scol0}{#1}
\colorlet{scol1}{#2}
\colorlet{scol2}{#3}
\colorlet{scol3}{#4}
}
% Define color schemes
\pgfplotsset{
/pgfplots/colorscheme/mako/.style={
colormap name={mako},
cycle list name={mako},
/utils/exec={\setschemecolors},
/pgfplots/colorscheme/cel/.style={
colormap name={cel},
cycle list name={cel},
/utils/exec={\setschemecolorsfrommap},
},
/pgfplots/colorscheme/rocket/.style={
colormap name={rocket},
cycle list name={rocket},
/utils/exec={\setschemecolors},
},
/pgfplots/colorscheme/cividis/.style={
colormap name={cividis},
cycle list name={cividis},
/utils/exec={\setschemecolors},
/utils/exec={\setschemecolorsfrommap},
},
/pgfplots/colorscheme/viridis/.style={
colormap name={viridis},
cycle list name={viridis},
/utils/exec={\setschemecolors},
/utils/exec={\setschemecolorsfrommap},
},
/pgfplots/colorscheme/cel/.style={
colormap name={cel},
cycle list name={cel},
/utils/exec={\setschemecolors},
/pgfplots/colorscheme/mako/.style={
colormap name={mako},
cycle list name={mako},
/utils/exec={\setschemecolorsfrommap},
},
/pgfplots/colorscheme/cividis/.style={
colormap name={cividis},
cycle list name={cividis},
/utils/exec={\setschemecolorsfrommap},
},
/pgfplots/colorscheme/matplotlib/.style={
colormap name={matplotlib},
cycle list name={matplotlib},
/utils/exec={\setschemecolorsmanually{Mpl1}{Mpl2}{Mpl3}{Mpl4}},
},
}

View File

@@ -1,5 +1,4 @@
FROM alpine:3.19
RUN apk update && apk upgrade
RUN apk add texlive
RUN apk add texmf-dist-pictures
RUN apk add make texlive texmf-dist-pictures

View File

@@ -3,7 +3,6 @@ FROM archlinux:latest
RUN pacman-key --init
RUN pacman-key --populate archlinux
RUN pacman -Sy archlinux-keyring --noconfirm && pacman -Su --noconfirm
# RUN pacman-key --refresh-keys
RUN pacman -Syu --noconfirm
RUN pacman -S perl texlive texlive-binextra texlive-pictures --noconfirm
RUN pacman -S make perl texlive texlive-binextra texlive-pictures --noconfirm

View File

@@ -3,5 +3,4 @@ FROM ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update -y && apt upgrade -y
RUN apt install neovim git -y
RUN apt install texlive latexmk texlive-pictures -y
RUN apt install make texlive latexmk texlive-pictures -y

View File

@@ -18,7 +18,6 @@
\input{common.tex}
\pgfplotsset{colorscheme/cel}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -26,61 +25,77 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{Colorschemes}
\author{}
\date{}
\begin{document}
\maketitle
\foreach \x in {cel, rocket, viridis, mako, cividis, matplotlib}{
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set colorscheme
\foreach \x in {cel, rocket, viridis, mako, cividis}{
\pgfplotsset{colorscheme/\x}
\colorbox{gray!30}{\texttt{colorscheme/\x}}
\begin{figure}[H]
\centering
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Preview colorscheme
\tikzstyle{colornode} = [draw, inner sep=0pt, minimum width=1cm, minimum height=0.5cm]
\pgfplotsset{scaled y ticks=false}
\noindent\begin{minipage}{\textwidth}
\colorbox{gray!30}{\texttt{colorscheme/\x}}
\begin{figure}[H]
\centering
\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}
\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}
\vspace{\parskip}
\end{minipage}
}