forked from GiovineItalia/Gadfly.jl
/
theme.jl
160 lines (114 loc) · 5.65 KB
/
theme.jl
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
# Parameters controlling how a plot appears
const title_font_desc = "'PT Sans','Helvetica Neue','Helvetica',sans-serif"
const label_font_desc = "'PT Sans Caption','Helvetica Neue','Helvetica',sans-serif"
# Choose highlight color by darkening the fill color
function default_discrete_highlight_color(fill_color::ColorValue)
return RGB(1, 1, 1)
end
function default_continuous_highlight_color(fill_color::ColorValue)
c = convert(LCHab, fill_color)
return LCHab(max(0, c.l - 40), c.c, c.h)
end
function default_stroke_color(fill_color::ColorValue)
fill_color = convert(LCHab, fill_color)
c = LCHab(fill_color.l, fill_color.c, fill_color.h)
LCHab(c.l - 15, c.c, c.h)
end
function default_lowlight_color(fill_color::ColorValue)
fill_color = convert(LCHab, fill_color)
c = LCHab(fill_color.l, fill_color.c, fill_color.h)
LCHab(90, 20, c.h)
end
# Choose a middle color by darkening the fill color
function default_middle_color(fill_color::ColorValue)
fill_color = convert(LCHab, fill_color)
LCHab(fill_color.l + 40, fill_color.c, fill_color.h)
end
@varset Theme begin
# If the color aesthetic is not mapped to anything, this is the color that
# is used.
default_color, ColorOrNothing, LCHab(70, 60, 240)
# Default size when the size aesthetic is not mapped.
default_point_size, Measure, 0.9mm
# Width of lines in the line geometry.
line_width, Measure, 0.3mm
# Background color of the plot.
panel_fill, ColorOrNothing, nothing
# Border color of the plot panel.
panel_stroke, ColorOrNothing, nothing
# Opacity of the plot background panel.
panel_opacity, Float64, 1.0
# Grid line color.
grid_color, ColorOrNothing, color("#D0D0E0")
grid_strokedash, Maybe(Vector), [0.5mm, 0.5mm]
# Grid lines for focused item.
grid_color_focused, ColorOrNothing, color("#A0A0A0")
# Width of grid lines
grid_line_width, Measure, 0.2mm
# Font name, size, and color used for tick labels, entries in keys, etc.
minor_label_font, String, label_font_desc
minor_label_font_size, Measure, 8pt
minor_label_color, ColorOrNothing, color("#6c606b")
# Font name, size and color used for axis labels, key title, etc.
major_label_font, String, title_font_desc
major_label_font_size, Measure, 11pt
major_label_color, ColorOrNothing, color("#564a55")
# Font name, size and color used for labels on plot elements.
point_label_font, String, label_font_desc
point_label_font_size, Measure, 8pt
point_label_color, ColorOrNothing, color("#4c404b")
# Font name, size and color used for key titles
key_title_font, String, title_font_desc
key_title_font_size, Measure, 11pt
key_title_color, ColorOrNothing, color("#362a35")
# Font name, size and color used for key entries.
key_label_font, String, title_font_desc
key_label_font_size, Measure, 8pt
key_label_color, ColorOrNothing, color("#4c404b")
# How many gradations to show in a continuous color key.
key_color_gradations, Int, 40
# Spacing between bars for Geom.bar.
bar_spacing, Measure, 0.0mm
# Spacing between boxplots in Geom.boxplot.
boxplot_spacing, Measure, 1mm
# Length of caps on error bars
errorbar_cap_length, Measure, 3mm
# Lines are drawn in a slightly different color than fills, e.g. to
# differentiate histogram bars from error bars.
stroke_color, Function, default_stroke_color
# Points, etc, are highlighted by stroking in slightly different color. This
# is the stroke width.
highlight_width, Measure, 0.3mm
# A function mapping fill color to stoke color for highlights.
discrete_highlight_color, Function, default_discrete_highlight_color
continuous_highlight_color, Function, default_continuous_highlight_color
# A function mapping fill color to a duller background fill color. Used for
# Geom.ribbon in particular so lines stand out against it.
lowlight_color, Function, default_lowlight_color
# Opacity of geometry filled with lowlight_color
lowlight_opacity, Float64, 0.6
# A function mapping base fill color to the color of the median marker in a
# boxplot.
middle_color, Function, default_middle_color
# Width of the middle line in a boxplot.
middle_width, Measure, 0.6mm
# Horizontal position of the title of color key guides. One of :left,
# :right, :center.
guide_title_position, Symbol, :left
# Shape used in color keys for color swatches. Either :square or :circle.
colorkey_swatch_shape, Symbol, :square
# One of :left, :right, :top, :bottom, :none determining where color keys
# and the like should be placed.
key_position, Symbol, :right
# TODO: This stuff is too incomprehensible to be in theme, I think. Put it
# somewhere else.
# Number of annealing iterations.
label_placement_iterations, Int, 1000
# Penalty for a label not being contained within the plot frame.
label_out_of_bounds_penalty, Float64, 10.0
# Penalty for making a label hidden to avoid overlaps.
label_hidden_penalty, Float64, 0.5
# Probability of proposing a visibility flip during label layout.
label_visibility_flip_pr, Float64, 0.2
end
const default_theme = Theme()