Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

563479 views
1
<?xml version="1.0" encoding="UTF-8"?>
2
3
<Chapter Label="colors">
4
<Heading>
5
The colors in the <Package>IntPic</Package> package
6
</Heading>
7
<!--<Index>&IntPic; - colors</Index>-->
8
9
The idea in what concerns the colors is the following: the reader is free to
10
choose his colors (taking into account that the latex <Package>xcolor</Package> package is
11
used), but we try to make users life reasonably easy. He is allowed to choose
12
tones. The default colors used by &IntPic; are not many, although (from our
13
experience) sufficient for most examples.
14
<!--Furthermore, we have functions that, especially when only a few of
15
the available colors are used, chose quite different colors.-->
16
<Section>
17
<Heading>Colors by tones</Heading>
18
The colors are divided by tones.
19
<!-- <Subsection>
20
<Heading>Tones</Heading>-->
21
<Listing Type="red"><![CDATA[
22
gap> IP_ColorsRedTones; #red
23
[ "red", "red!50", "red!20", "red!80!green!50", "red!80!blue!60" ]
24
]]></Listing>
25
<Alt Only="LaTeX">
26
\begin{center}
27
\includegraphics[scale=1.2]{../images/red_tones.pdf}
28
\end{center}
29
</Alt>
30
<Alt Only="HTML">
31
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;../images/red_tones.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
32
</Alt>
33
<Listing Type="green"><![CDATA[
34
gap> IP_ColorsGreenTones; #green
35
[ "green", "green!50", "green!20", "green!80!red!50", "green!80!blue!60" ]
36
]]></Listing>
37
<Alt Only="LaTeX">
38
\begin{center}
39
\includegraphics[scale=1.2]{../images/green_tones.pdf}
40
\end{center}
41
</Alt>
42
<Alt Only="HTML">
43
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;../images/green_tones.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
44
</Alt>
45
<Listing Type="blue"><![CDATA[
46
gap> IP_ColorsBlueTones; #blue
47
[ "blue", "blue!50", "blue!20", "blue!80!red!50", "blue!80!green!60" ]
48
]]></Listing>
49
<Alt Only="LaTeX">
50
\begin{center}
51
\includegraphics[scale=1.2]{../images/blue_tones.pdf}
52
\end{center}
53
</Alt>
54
<Alt Only="HTML">
55
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;../images/blue_tones.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
56
</Alt>
57
<Listing Type="cyan"><![CDATA[
58
gap> IP_ColorsCompRedTones; # cyan (complement of red)
59
[ "-red", "-red!50", "-red!20", "-red!80!green!50", "-red!80!blue!60" ]
60
]]></Listing>
61
<Alt Only="LaTeX">
62
\begin{center}
63
\includegraphics[scale=1.2]{../images/comp_red_tones.pdf}
64
\end{center}
65
</Alt>
66
<Alt Only="HTML">
67
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;../images/comp_red_tones.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
68
</Alt>
69
<Listing Type="magenta"><![CDATA[
70
gap> IP_ColorsCompGreenTones; # magenta (complement of green)
71
[ "-green", "-green!50", "-green!20", "-green!80!red!50", "-green!80!blue!60"
72
]
73
]]></Listing>
74
<Alt Only="LaTeX">
75
\begin{center}
76
\includegraphics[scale=1.2]{../images/comp_green_tones.pdf}
77
\end{center}
78
</Alt>
79
<Alt Only="HTML">
80
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;../images/comp_green_tones.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
81
</Alt>
82
<Listing Type="yellow"><![CDATA[
83
gap> IP_ColorsCompBlueTones; # yellow (complement of blue)
84
[ "-blue", "-blue!50", "-blue!20", "-blue!80!red!50", "-blue!80!green!60" ]
85
]]></Listing>
86
<Alt Only="LaTeX">
87
\begin{center}
88
\includegraphics[scale=1.2]{../images/comp_blue_tones.pdf}
89
\end{center}
90
</Alt>
91
<Alt Only="HTML">
92
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;../images/comp_blue_tones.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
93
</Alt>
94
<Listing Type="dark gray"><![CDATA[
95
gap> IP_ColorsDGrayTones; # dark gray
96
[ "black!80", "black!70", "black!60", "black!50", "black!40" ]
97
]]></Listing>
98
<Alt Only="LaTeX">
99
\begin{center}
100
\includegraphics[scale=1.2]{../images/dark_gray_tones.pdf}
101
\end{center}
102
</Alt>
103
<Alt Only="HTML">
104
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;../images/dark_gray_tones.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
105
</Alt>
106
<Listing Type="light gray"><![CDATA[
107
gap> IP_ColorsLGrayTones; # light gray
108
[ "black!30", "black!25", "black!20", "black!15", "black!10" ]
109
]]></Listing>
110
<Alt Only="LaTeX">
111
\begin{center}
112
\includegraphics[scale=1.2]{../images/light_gray_tones.pdf}
113
\end{center}
114
</Alt>
115
<Alt Only="HTML">
116
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;../images/light_gray_tones.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
117
</Alt>
118
</Section>
119
<Section>
120
<Heading>Lists of colors</Heading>
121
<Listing Type="array of colors by tones"><![CDATA[
122
gap> ListsOfIP_Colors;
123
[ [ "red", "red!50", "red!20", "red!80!green!50", "red!80!blue!60" ],
124
[ "green", "green!50", "green!20", "green!80!red!50", "green!80!blue!60" ],
125
[ "blue", "blue!50", "blue!20", "blue!80!red!50", "blue!80!green!60" ],
126
[ "-red", "-red!50", "-red!20", "-red!80!green!50", "-red!80!blue!60" ],
127
[ "-green", "-green!50", "-green!20", "-green!80!red!50",
128
"-green!80!blue!60" ],
129
[ "-blue", "-blue!50", "-blue!20", "-blue!80!red!50", "-blue!80!green!60" ],
130
[ "black!80", "black!70", "black!60", "black!50", "black!40" ],
131
[ "black!30", "black!25", "black!20", "black!15", "black!10" ] ]
132
]]></Listing>
133
<Listing Type="list of colors by tones"><![CDATA[
134
gap> IP_Colors;
135
[ "red", "red!50", "red!20", "red!80!green!50", "red!80!blue!60", "green",
136
"green!50", "green!20", "green!80!red!50", "green!80!blue!60", "blue",
137
"blue!50", "blue!20", "blue!80!red!50", "blue!80!green!60", "-red",
138
"-red!50", "-red!20", "-red!80!green!50", "-red!80!blue!60", "-green",
139
"-green!50", "-green!20", "-green!80!red!50", "-green!80!blue!60", "-blue",
140
"-blue!50", "-blue!20", "-blue!80!red!50", "-blue!80!green!60", "black!80",
141
"black!70", "black!60", "black!50", "black!40", "black!30", "black!25",
142
"black!20", "black!15", "black!10" ]
143
]]></Listing>
144
</Section>
145
<Section>
146
<Heading>The <Package>IntPic</Package> default list of colors</Heading>
147
The colors are shuffled by concatenating the transposed of the matrix
148
<C>ListsOfIP_Colors</C>. The list obtained is taken as the default list of colors.
149
<Listing Type="default list of colors"><![CDATA[
150
gap> ShuffledIP_colors;
151
[ "red", "green", "blue", "-red", "-green", "-blue", "black!80", "black!30",
152
"red!50", "green!50", "blue!50", "-red!50", "-green!50", "-blue!50",
153
"black!70", "black!25", "red!20", "green!20", "blue!20", "-red!20",
154
"-green!20", "-blue!20", "black!60", "black!20", "red!80!green!50",
155
"green!80!red!50", "blue!80!red!50", "-red!80!green!50", "-green!80!red!50",
156
"-blue!80!red!50", "black!50", "black!15", "red!80!blue!60",
157
"green!80!blue!60", "blue!80!green!60", "-red!80!blue!60",
158
"-green!80!blue!60", "-blue!80!green!60", "black!40", "black!10" ]
159
]]></Listing>
160
<Alt Only="LaTeX">
161
\begin{center}
162
\includegraphics[width=0.8\textwidth]{../images/intpic_default_colors.pdf}
163
\end{center}
164
</Alt>
165
<Alt Only="HTML">
166
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;../images/intpic_default_colors.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
167
</Alt>
168
These are the &IntPic; default colors. Although the user is free to use other colors, we warn that there is a need of compatibility with the colors used in other packages (the
169
&LaTeX; <Package>xcolor</Package>, for instance).
170
171
To emphasize the integers of some sets by using some of the colors in some list of colors (for instance the default colors) one may use empty lists to force the non usage of the colors whose order in the list of colors is the order of these empty lists in the array of integers to be emphasized.
172
173
<Example><![CDATA[
174
gap> m3 := Filtered([1..40],i->i mod 3=0);
175
[ 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39 ]
176
gap> m5 := Filtered([1..40],i->i mod 5=0);
177
[ 5, 10, 15, 20, 25, 30, 35, 40 ]
178
gap> m7 := Filtered([1..40],i->i mod 7=0);
179
[ 7, 14, 21, 28, 35 ]
180
gap>
181
gap> arr := [[],[],m3,[],m5,[],m7];;
182
gap> tkz:=IP_TikzArrayOfIntegers([1..40],10,rec(highlights:=arr));;
183
]]></Example>
184
<Alt Only="LaTeX">
185
\begin{center}
186
\includegraphics[width=0.8\textwidth]{../images/mults_3_5_7}
187
\end{center}
188
</Alt>
189
<Alt Only="HTML">
190
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;../images/mults_3_5_7.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
191
</Alt>
192
193
</Section>
194
<Section>
195
<Heading>Functions to deal with colors</Heading>
196
<!--
197
<ManSection>
198
<Heading>Auxiliary functions -- picking some elements from lists</Heading>
199
<Func Name="PickElementsFromList" Arg="arg"/>
200
<Description>
201
input: source is a list of length s; n is the number of elements to be picked
202
the distance between the elements picked is approximately the number of
203
remaining elements by the number of deserts. The first element is always
204
picked.
205
<Example><![CDATA[
206
gap> PickElementsFromList([1..20],3);
207
[ 1, 10, 19 ]
208
gap> PickElementsFromList([1..20],5);
209
[ 1, 5, 9, 13, 17 ]
210
]]></Example>
211
</Description>
212
<Func Name="PickSublistsFromListOfLists" Arg="arg"/>
213
<Description>
214
uses PickElementsFromList...
215
<Example><![CDATA[
216
gap> PickSublistsFromListOfLists([[1..20],[1..20]],[3,5]);
217
[ [ 1, 10, 19 ], [ 1, 5, 9, 13, 17 ] ]
218
]]></Example>
219
</Description>
220
</ManSection>
221
<ManSection>
222
<Heading>Creating tables of colors by tones</Heading>
223
<Func Name="IP_ColorsByTones" Arg="arg"/>
224
<Description>
225
the input is either a list of tones or are tones
226
<Example><![CDATA[
227
gap> IP_ColorsByTones("Reds","Blues");
228
[ [ "red", "red!50", "red!20", "red!80!green!50", "red!80!blue!60" ],
229
[ "blue", "blue!50", "blue!20", "blue!80!red!50", "blue!80!green!60" ] ]
230
]]></Example>
231
<Example><![CDATA[
232
gap> IP_ColorsByTones("Red","Blues");
233
the strings [ "Red" ] does not correspond to lists of colors
234
and will be ignored.
235
[ [ "blue", "blue!50", "blue!20", "blue!80!red!50", "blue!80!green!60" ] ]
236
]]></Example>
237
</Description>
238
</ManSection>
239
240
<ManSection>
241
<Heading>Picking colors for one picture</Heading>
242
<Func Name="IP_ColorsForOneImage" Arg="arg"/>
243
<Description>
244
this function has as input a list of tones (from the list
245
RecNames(RecordOfColorsForIP_);
246
["Reds","rEDS","Greens","gREENS","Blues","bLUES","DGrays","LGrays"]) and a
247
number (which is the number of colors to be used)
248
-- the tones list is optional: if it is not present, all colors are used.
249
-- the number is optional too: when not present, the colors used are all the
250
colors of the selected tones. For each tone there is a list of *5* colors
251
<P/>
252
The output is a table of colors that are as far as possible from being similar
253
<Example><![CDATA[
254
gap> IP_ColorsForOneImage("rEDS","LGrays",5);
255
[ [ "-red", "-red!20", "-red!80!blue!60" ],
256
[ "black!30", "black!20", "black!10" ] ]
257
]]></Example>
258
</Description>
259
</ManSection>
260
-->
261
For the moment we only provide one function, which shuffles colors from lists of colors.
262
<ManSection>
263
<Heading>Shuffle colors from lists of colors</Heading>
264
<Func Name="ShuffleIP_Colors" Arg="mat"/>
265
<Description>
266
The argument <A>mat</A> is a list of lists of colors of the same length. The output is obtained by concatenating the transposed of <A>mat</A>.
267
<Example><![CDATA[
268
gap> ShuffleIP_Colors([IP_ColorsRedTones,IP_ColorsCompBlueTones]);
269
[ "red", "-blue", "red!50", "-blue!50", "red!20", "-blue!20",
270
"red!80!green!50", "-blue!80!red!50", "red!80!blue!60", "-blue!80!green!60"
271
]
272
]]></Example>
273
<Alt Only="LaTeX">
274
\begin{center}
275
\includegraphics[scale=1.2]{../images/shuffle_red_comp_blue.pdf}
276
\end{center}
277
</Alt>
278
<Alt Only="HTML">
279
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;../images/shuffle_red_comp_blue.jpg&#34;&#62;&#60;/center&#62;&#60;br&#62;
280
</Alt>
281
282
</Description>
283
</ManSection>
284
285
</Section>
286
</Chapter>
287
288