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