| 1 |
% \iffalse meta-comment ------------------------------------------------------- |
| 2 |
% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of |
| 3 |
% contributors can be found at |
| 4 |
% |
| 5 |
% https://github.com/matze/mtheme/graphs/contributors |
| 6 |
% |
| 7 |
% and these colors were inspired by the Paul Tol 21-color Salute by Peter Carl. |
| 8 |
% |
| 9 |
% http://www.r-bloggers.com/the-paul-tol-21-color-salute/ |
| 10 |
% |
| 11 |
% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 |
| 12 |
% International License (https://creativecommons.org/licenses/by-sa/4.0/). |
| 13 |
% ------------------------------------------------------------------------- \fi |
| 14 |
% \iffalse |
| 15 |
%<driver> \ProvidesFile{pgfplotsthemetol.dtx} |
| 16 |
%<*package> |
| 17 |
\NeedsTeXFormat{LaTeX2e} |
| 18 |
\ProvidesPackage{pgfplotsthemetol} |
| 19 |
[2017/01/23 PGFplots colors based on Paul Tol's SRON technical note] |
| 20 |
%</package> |
| 21 |
%<driver> \documentclass{ltxdoc} |
| 22 |
%<driver> \usepackage{pgfplotsthemetol} |
| 23 |
%<driver> \begin{document} |
| 24 |
%<driver> \DocInput{pgfplotsthemetol.dtx} |
| 25 |
%<driver> \end{document} |
| 26 |
% \fi |
| 27 |
% \CheckSum{0} |
| 28 |
% \StopEventually{} |
| 29 |
% \iffalse |
| 30 |
%<*package> |
| 31 |
% ------------------------------------------------------------------------- \fi |
| 32 |
% |
| 33 |
% \subsection{Tol \texttt{pgfplots} theme} |
| 34 |
% |
| 35 |
% Paul Tol's 12-color palette\footnote{Tol actually describes several |
| 36 |
% palettes; these colours are taken from the bottom row of Figure 3 in his |
| 37 |
% technical note.} is as follows: |
| 38 |
% |
| 39 |
% \begin{macrocode} |
| 40 |
\definecolor{TolDarkPurple}{HTML}{332288} |
| 41 |
\definecolor{TolDarkBlue}{HTML}{6699CC} |
| 42 |
\definecolor{TolLightBlue}{HTML}{88CCEE} |
| 43 |
\definecolor{TolLightGreen}{HTML}{44AA99} |
| 44 |
\definecolor{TolDarkGreen}{HTML}{117733} |
| 45 |
\definecolor{TolDarkBrown}{HTML}{999933} |
| 46 |
\definecolor{TolLightBrown}{HTML}{DDCC77} |
| 47 |
\definecolor{TolDarkRed}{HTML}{661100} |
| 48 |
\definecolor{TolLightRed}{HTML}{CC6677} |
| 49 |
\definecolor{TolLightPink}{HTML}{AA4466} |
| 50 |
\definecolor{TolDarkPink}{HTML}{882255} |
| 51 |
\definecolor{TolLightPurple}{HTML}{AA4499} |
| 52 |
% \end{macrocode} |
| 53 |
% |
| 54 |
% To use these colors, we describe ``cycle lists'' from which PGF chooses |
| 55 |
% styles for the different series in a chart. |
| 56 |
% |
| 57 |
% \begin{macro}{mbarplot cycle} |
| 58 |
% Colors and styles intended for bar charts with up to 12 series. |
| 59 |
% |
| 60 |
% \begin{macrocode} |
| 61 |
\pgfplotscreateplotcyclelist{mbarplot cycle}{% |
| 62 |
{draw=TolDarkBlue, fill=TolDarkBlue!70}, |
| 63 |
{draw=TolLightBrown, fill=TolLightBrown!70}, |
| 64 |
{draw=TolLightGreen, fill=TolLightGreen!70}, |
| 65 |
{draw=TolDarkPink, fill=TolDarkPink!70}, |
| 66 |
{draw=TolDarkPurple, fill=TolDarkPurple!70}, |
| 67 |
{draw=TolDarkRed, fill=TolDarkRed!70}, |
| 68 |
{draw=TolDarkBrown, fill=TolDarkBrown!70}, |
| 69 |
{draw=TolLightRed, fill=TolLightRed!70}, |
| 70 |
{draw=TolLightPink, fill=TolLightPink!70}, |
| 71 |
{draw=TolLightPurple, fill=TolLightPurple!70}, |
| 72 |
{draw=TolLightBlue, fill=TolLightBlue!70}, |
| 73 |
{draw=TolDarkGreen, fill=TolDarkGreen!70}, |
| 74 |
} |
| 75 |
% \end{macrocode} |
| 76 |
% \end{macro} |
| 77 |
% |
| 78 |
% \begin{macro}{mlineplot cycle} |
| 79 |
% Colors and styles intended for line charts with up to 4 series. |
| 80 |
% \begin{macrocode} |
| 81 |
\pgfplotscreateplotcyclelist{mlineplot cycle}{% |
| 82 |
{TolDarkBlue, mark=*, mark size=1.5pt}, |
| 83 |
{TolLightBrown, mark=square*, mark size=1.3pt}, |
| 84 |
{TolLightGreen, mark=triangle*, mark size=1.5pt}, |
| 85 |
{TolDarkBrown, mark=diamond*, mark size=1.5pt}, |
| 86 |
} |
| 87 |
% \end{macrocode} |
| 88 |
% \end{macro} |
| 89 |
% |
| 90 |
% However, the above cycle lists are not applied automatically. We still need |
| 91 |
% to define styles --- |mlineplot| and |mbarplot| --- that the user can apply |
| 92 |
% to the axis of a |pgfplots| chart to use the colors. We'll also take the |
| 93 |
% opportunity to adjust the display of chart axes when these styles are used. |
| 94 |
% |
| 95 |
% \begin{macrocode} |
| 96 |
\pgfplotsset{ |
| 97 |
compat=1.9, |
| 98 |
% \end{macrocode} |
| 99 |
% |
| 100 |
% \begin{macro}{mlineplot} |
| 101 |
% A style to apply to the axis of a PGF line plot. |
| 102 |
% \begin{macrocode} |
| 103 |
mlineplot/.style={ |
| 104 |
mbaseplot, |
| 105 |
xmajorgrids=true, |
| 106 |
ymajorgrids=true, |
| 107 |
major grid style={dotted}, |
| 108 |
axis x line=bottom, |
| 109 |
axis y line=left, |
| 110 |
legend style={ |
| 111 |
cells={anchor=west}, |
| 112 |
draw=none |
| 113 |
}, |
| 114 |
cycle list name=mlineplot cycle, |
| 115 |
}, |
| 116 |
% \end{macrocode} |
| 117 |
% \end{macro} |
| 118 |
% \begin{macro}{mbarplot} |
| 119 |
% \begin{macro}{horizontal mbarplot} |
| 120 |
% A style to apply to the axis of a PGF bar chart. |mbarplot| uses vertical |
| 121 |
% bars by default, while |horizontal mbarplot| has horizontal bars as the |
| 122 |
% name implies. Their shared properties are factored out into the internal |
| 123 |
% style |mbarplot base|. |
| 124 |
% |
| 125 |
% \begin{macrocode} |
| 126 |
mbarplot base/.style={ |
| 127 |
mbaseplot, |
| 128 |
bar width=6pt, |
| 129 |
axis y line*=none, |
| 130 |
}, |
| 131 |
mbarplot/.style={ |
| 132 |
mbarplot base, |
| 133 |
ybar, |
| 134 |
xmajorgrids=false, |
| 135 |
ymajorgrids=true, |
| 136 |
area legend, |
| 137 |
legend image code/.code={% |
| 138 |
\draw[#1] (0cm,-0.1cm) rectangle (0.15cm,0.1cm); |
| 139 |
}, |
| 140 |
cycle list name=mbarplot cycle, |
| 141 |
}, |
| 142 |
horizontal mbarplot/.style={ |
| 143 |
mbarplot base, |
| 144 |
xmajorgrids=true, |
| 145 |
ymajorgrids=false, |
| 146 |
xbar stacked, |
| 147 |
area legend, |
| 148 |
legend image code/.code={% |
| 149 |
\draw[#1] (0cm,-0.1cm) rectangle (0.15cm,0.1cm); |
| 150 |
}, |
| 151 |
cycle list name=mbarplot cycle, |
| 152 |
}, |
| 153 |
% \end{macrocode} |
| 154 |
% \end{macro} |
| 155 |
% \end{macro} |
| 156 |
% \begin{macro}{mbaseplot} |
| 157 |
% Adjusts the appearance of the axes in a PGF chart. |
| 158 |
% \begin{macrocode} |
| 159 |
mbaseplot/.style={ |
| 160 |
legend style={ |
| 161 |
draw=none, |
| 162 |
fill=none, |
| 163 |
cells={anchor=west}, |
| 164 |
}, |
| 165 |
x tick label style={ |
| 166 |
font=\footnotesize |
| 167 |
}, |
| 168 |
y tick label style={ |
| 169 |
font=\footnotesize |
| 170 |
}, |
| 171 |
legend style={ |
| 172 |
font=\footnotesize |
| 173 |
}, |
| 174 |
major grid style={ |
| 175 |
dotted, |
| 176 |
}, |
| 177 |
axis x line*=bottom, |
| 178 |
}, |
| 179 |
disable thousands separator/.style={ |
| 180 |
/pgf/number format/.cd, |
| 181 |
1000 sep={} |
| 182 |
}, |
| 183 |
} |
| 184 |
% \end{macrocode} |
| 185 |
% \end{macro} |
| 186 |
% \iffalse |
| 187 |
%</package> |
| 188 |
% \fi |
| 189 |
% \Finale |
| 190 |
\endinput |