11
11
# ' legend titles, the plot title and tag text.
12
12
# ' @param base_line_size base size for line elements
13
13
# ' @param base_rect_size base size for rect elements
14
- # ' @param ink,paper colour for foreground and background elements respectively.
14
+ # ' @param ink,paper,accent colour for foreground, background, and accented elements respectively.
15
15
# '
16
16
# ' @details
17
17
# ' \describe{
@@ -108,7 +108,7 @@ theme_grey <- function(base_size = 11, base_family = "",
108
108
header_family = NULL ,
109
109
base_line_size = base_size / 22 ,
110
110
base_rect_size = base_size / 22 ,
111
- ink = " black" , paper = " white" ) {
111
+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
112
112
113
113
# The half-line (base-fontsize / 2) sets up the basic vertical
114
114
# rhythm of the theme. Most margins will be set to this value.
@@ -157,7 +157,7 @@ theme_grey <- function(base_size = 11, base_family = "",
157
157
),
158
158
159
159
geom = element_geom(
160
- ink = ink , paper = paper , accent = " #3366FF " ,
160
+ ink = ink , paper = paper , accent = accent ,
161
161
linewidth = base_line_size , borderwidth = base_line_size ,
162
162
linetype = 1L , bordertype = 1L ,
163
163
family = base_family , fontsize = base_size ,
@@ -288,15 +288,15 @@ theme_bw <- function(base_size = 11, base_family = "",
288
288
header_family = NULL ,
289
289
base_line_size = base_size / 22 ,
290
290
base_rect_size = base_size / 22 ,
291
- ink = " black" , paper = " white" ) {
291
+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
292
292
# Starts with theme_grey and then modify some parts
293
293
theme_grey(
294
294
base_size = base_size ,
295
295
base_family = base_family ,
296
296
header_family = header_family ,
297
297
base_line_size = base_line_size ,
298
298
base_rect_size = base_rect_size ,
299
- ink = ink , paper = paper
299
+ ink = ink , paper = paper , accent = accent
300
300
) %+ replace %
301
301
theme(
302
302
# white background and dark border
@@ -321,7 +321,7 @@ theme_linedraw <- function(base_size = 11, base_family = "",
321
321
header_family = NULL ,
322
322
base_line_size = base_size / 22 ,
323
323
base_rect_size = base_size / 22 ,
324
- ink = " black" , paper = " white" ) {
324
+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
325
325
half_line <- base_size / 2
326
326
327
327
# Starts with theme_bw and then modify some parts
@@ -332,7 +332,7 @@ theme_linedraw <- function(base_size = 11, base_family = "",
332
332
header_family = header_family ,
333
333
base_line_size = base_line_size ,
334
334
base_rect_size = base_rect_size ,
335
- ink = ink , paper = paper
335
+ ink = ink , paper = paper , accent = accent
336
336
) %+ replace %
337
337
theme(
338
338
# black text and ticks on the axes
@@ -365,7 +365,7 @@ theme_light <- function(base_size = 11, base_family = "",
365
365
header_family = NULL ,
366
366
base_line_size = base_size / 22 ,
367
367
base_rect_size = base_size / 22 ,
368
- ink = " black" , paper = " white" ) {
368
+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
369
369
half_line <- base_size / 2
370
370
371
371
# Starts with theme_grey and then modify some parts
@@ -375,7 +375,7 @@ theme_light <- function(base_size = 11, base_family = "",
375
375
header_family = header_family ,
376
376
base_line_size = base_line_size ,
377
377
base_rect_size = base_rect_size ,
378
- ink = ink , paper = paper
378
+ ink = ink , paper = paper , accent = accent
379
379
) %+ replace %
380
380
theme(
381
381
# white panel with light grey border
@@ -409,7 +409,7 @@ theme_dark <- function(base_size = 11, base_family = "",
409
409
header_family = NULL ,
410
410
base_line_size = base_size / 22 ,
411
411
base_rect_size = base_size / 22 ,
412
- ink = " black" , paper = " white" ) {
412
+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
413
413
half_line <- base_size / 2
414
414
415
415
# Starts with theme_grey and then modify some parts
@@ -419,7 +419,7 @@ theme_dark <- function(base_size = 11, base_family = "",
419
419
header_family = header_family ,
420
420
base_line_size = base_line_size ,
421
421
base_rect_size = base_rect_size ,
422
- ink = ink , paper = paper
422
+ ink = ink , paper = paper , accent = accent
423
423
) %+ replace %
424
424
theme(
425
425
# dark panel
@@ -451,15 +451,15 @@ theme_minimal <- function(base_size = 11, base_family = "",
451
451
header_family = NULL ,
452
452
base_line_size = base_size / 22 ,
453
453
base_rect_size = base_size / 22 ,
454
- ink = " black" , paper = " white" ) {
454
+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
455
455
# Starts with theme_bw and remove most parts
456
456
theme_bw(
457
457
base_size = base_size ,
458
458
base_family = base_family ,
459
459
header_family = header_family ,
460
460
base_line_size = base_line_size ,
461
461
base_rect_size = base_rect_size ,
462
- ink = ink , paper = paper
462
+ ink = ink , paper = paper , accent = accent
463
463
) %+ replace %
464
464
theme(
465
465
axis.ticks = element_blank(), # Extra margins due to absence ticks
@@ -484,14 +484,14 @@ theme_classic <- function(base_size = 11, base_family = "",
484
484
header_family = NULL ,
485
485
base_line_size = base_size / 22 ,
486
486
base_rect_size = base_size / 22 ,
487
- ink = " black" , paper = " white" ) {
487
+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
488
488
theme_bw(
489
489
base_size = base_size ,
490
490
base_family = base_family ,
491
491
header_family = header_family ,
492
492
base_line_size = base_line_size ,
493
493
base_rect_size = base_rect_size ,
494
- ink = ink , paper = paper
494
+ ink = ink , paper = paper , accent = accent
495
495
) %+ replace %
496
496
theme(
497
497
# no background and no grid
@@ -517,7 +517,7 @@ theme_void <- function(base_size = 11, base_family = "",
517
517
header_family = NULL ,
518
518
base_line_size = base_size / 22 ,
519
519
base_rect_size = base_size / 22 ,
520
- ink = " black" , paper = alpha(ink , 0 )) {
520
+ ink = " black" , paper = alpha(ink , 0 ), accent = " #3366FF " ) {
521
521
half_line <- base_size / 2
522
522
523
523
# Only keep indispensable text: legend and plot titles
@@ -538,6 +538,13 @@ theme_void <- function(base_size = 11, base_family = "",
538
538
title = element_text(family = header_family ),
539
539
spacing = unit(half_line , " pt" ),
540
540
margins = margin_auto(half_line ),
541
+ geom = element_geom(
542
+ ink = ink , paper = paper , accent = accent ,
543
+ linewidth = base_line_size , borderwidth = base_line_size ,
544
+ linetype = 1L , bordertype = 1L ,
545
+ family = base_family , fontsize = base_size ,
546
+ pointsize = (base_size / 11 ) * 1.5 , pointshape = 19
547
+ ),
541
548
axis.text = element_blank(),
542
549
axis.title = element_blank(),
543
550
axis.ticks.length = rel(0 ),
@@ -608,7 +615,7 @@ theme_test <- function(base_size = 11, base_family = "",
608
615
header_family = NULL ,
609
616
base_line_size = base_size / 22 ,
610
617
base_rect_size = base_size / 22 ,
611
- ink = " black" , paper = " white" ) {
618
+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
612
619
half_line <- base_size / 2
613
620
614
621
t <- theme(
@@ -639,7 +646,7 @@ theme_test <- function(base_size = 11, base_family = "",
639
646
spacing = unit(half_line , " pt" ),
640
647
margins = margin_auto(half_line ),
641
648
geom = element_geom(
642
- ink = ink , paper = paper , accent = " #3366FF " ,
649
+ ink = ink , paper = paper , accent = accent ,
643
650
linewidth = base_line_size , borderwidth = base_line_size ,
644
651
family = base_family , fontsize = base_size ,
645
652
linetype = 1L ,
0 commit comments