-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpresets.cpp
More file actions
164 lines (155 loc) · 5.22 KB
/
presets.cpp
File metadata and controls
164 lines (155 loc) · 5.22 KB
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
#include "gnuplotpp/presets.hpp"
namespace gnuplotpp {
PresetDefaults preset_defaults(Preset preset) {
PresetDefaults defaults;
switch (preset) {
case Preset::IEEE_SingleColumn:
defaults.size = FigureSizeInches{.w = 3.5, .h = 2.5};
defaults.style.font = "Times";
defaults.style.font_pt = 8.5;
defaults.style.line_width_pt = 1.0;
defaults.style.point_size = 0.6;
defaults.style.grid = false;
break;
case Preset::IEEE_DoubleColumn:
defaults.size = FigureSizeInches{.w = 7.16, .h = 2.8};
defaults.style.font = "Times";
defaults.style.font_pt = 8.5;
defaults.style.line_width_pt = 1.0;
defaults.style.point_size = 0.6;
defaults.style.grid = false;
break;
case Preset::AIAA_Column:
defaults.size = FigureSizeInches{.w = 3.25, .h = 2.4};
defaults.style.font = "Times";
defaults.style.font_pt = 8.0;
defaults.style.line_width_pt = 1.0;
defaults.style.point_size = 0.6;
defaults.style.grid = false;
break;
case Preset::AIAA_Page:
defaults.size = FigureSizeInches{.w = 7.0, .h = 2.8};
defaults.style.font = "Times";
defaults.style.font_pt = 8.0;
defaults.style.line_width_pt = 1.0;
defaults.style.point_size = 0.6;
defaults.style.grid = false;
break;
case Preset::IEEE_Tran:
defaults.size = FigureSizeInches{.w = 3.5, .h = 2.4};
defaults.style.font = "Times";
defaults.style.font_pt = 8.0;
defaults.style.line_width_pt = 1.0;
defaults.style.point_size = 0.6;
defaults.style.grid = false;
break;
case Preset::Nature_1Col:
defaults.size = FigureSizeInches{.w = 3.54, .h = 2.5};
defaults.style.font = "Arial";
defaults.style.font_pt = 8.0;
defaults.style.line_width_pt = 1.0;
defaults.style.point_size = 0.7;
defaults.style.grid = false;
break;
case Preset::Elsevier_1Col:
defaults.size = FigureSizeInches{.w = 3.35, .h = 2.4};
defaults.style.font = "Times";
defaults.style.font_pt = 8.0;
defaults.style.line_width_pt = 1.0;
defaults.style.point_size = 0.6;
defaults.style.grid = false;
break;
case Preset::Custom:
defaults.size = FigureSizeInches{.w = 3.5, .h = 2.5};
defaults.style = Style{};
break;
}
return defaults;
}
void apply_preset_defaults(FigureSpec& spec,
bool overwrite_size,
bool overwrite_style) {
const auto defaults = preset_defaults(spec.preset);
if (overwrite_size) {
spec.size = defaults.size;
}
if (overwrite_style) {
spec.style = defaults.style;
}
if ((spec.preset == Preset::AIAA_Column || spec.preset == Preset::AIAA_Page) &&
spec.style.font_pt < 8.0) {
spec.style.font_pt = 8.0;
}
}
void apply_style_profile(FigureSpec& spec, StyleProfile profile) {
switch (profile) {
case StyleProfile::Science:
spec.style.font = "Times";
spec.style.font_pt = 12.0;
spec.style.line_width_pt = 1.5;
spec.style.grid = true;
spec.style.tick_font_scale = 1.0;
spec.style.label_font_scale = 4.0 / 3.0;
spec.style.title_font_scale = 4.0 / 3.0;
spec.style.title_bold = true;
spec.palette = ColorPalette::Tab10;
break;
case StyleProfile::IEEE_Strict:
spec.style.font = "Times";
spec.style.font_pt = 8.5;
spec.style.line_width_pt = 1.0;
spec.style.grid = false;
spec.style.tick_font_scale = 1.0;
spec.style.label_font_scale = 1.0;
spec.style.title_font_scale = 1.0;
spec.style.title_bold = false;
spec.palette = ColorPalette::Grayscale;
break;
case StyleProfile::AIAA_Strict:
spec.style.font = "Times";
spec.style.font_pt = 8.0;
spec.style.line_width_pt = 1.0;
spec.style.grid = false;
spec.style.tick_font_scale = 1.0;
spec.style.label_font_scale = 1.0;
spec.style.title_font_scale = 1.0;
spec.style.title_bold = false;
spec.palette = ColorPalette::Default;
break;
case StyleProfile::Presentation:
spec.style.font = "Helvetica";
spec.style.font_pt = 12.0;
spec.style.line_width_pt = 2.0;
spec.style.grid = true;
spec.style.tick_font_scale = 1.0;
spec.style.label_font_scale = 1.15;
spec.style.title_font_scale = 1.25;
spec.style.title_bold = true;
spec.palette = ColorPalette::Viridis;
break;
case StyleProfile::DarkPrintSafe:
spec.style.font = "Times";
spec.style.font_pt = 9.0;
spec.style.line_width_pt = 1.6;
spec.style.grid = true;
spec.style.tick_font_scale = 1.0;
spec.style.label_font_scale = 1.08;
spec.style.title_font_scale = 1.15;
spec.style.title_bold = true;
spec.palette = ColorPalette::Grayscale;
break;
case StyleProfile::Tufte_Minimal:
spec.style.font = "Helvetica";
spec.style.font_pt = 12.5;
spec.style.line_width_pt = 1.8;
spec.style.point_size = 0.6;
spec.style.grid = false;
spec.style.tick_font_scale = 1.0;
spec.style.label_font_scale = 1.30;
spec.style.title_font_scale = 1.55;
spec.style.title_bold = true;
spec.palette = ColorPalette::Grayscale;
break;
}
}
} // namespace gnuplotpp