8
8
# '
9
9
# ' @note
10
10
# ' The `distiller` scales extend brewer to continuous scales by smoothly
11
- # ' interpolating 6 colours from any palette to a continuous scale.
11
+ # ' interpolating 7 colours from any palette to a continuous scale.
12
12
# '
13
13
# ' @details
14
14
# ' The `brewer` scales were carefully designed and tested on discrete data.
@@ -84,8 +84,9 @@ scale_colour_distiller <- function(..., type = "seq", palette = 1, direction = -
84
84
warning(" Using a discrete colour palette in a continuous scale.\n Consider using type = \" seq\" or type = \" div\" instead" , call. = FALSE )
85
85
}
86
86
continuous_scale(aesthetics , " distiller" ,
87
- gradient_n_pal(brewer_pal(type , palette , direction )(6 ), values , space ), na.value = na.value , guide = guide , ... )
88
- # NB: 6 colours per palette gives nice gradients; more results in more saturated colours which do not look as good
87
+ gradient_n_pal(brewer_pal(type , palette , direction )(7 ), values , space ), na.value = na.value , guide = guide , ... )
88
+ # NB: 6-7 colours per palette gives nice gradients; more results in more saturated colours which do not look as good
89
+ # For diverging scales, you need an odd number to make sure the mid-point is in the center
89
90
}
90
91
91
92
# ' @export
@@ -96,7 +97,7 @@ scale_fill_distiller <- function(..., type = "seq", palette = 1, direction = -1,
96
97
warning(" Using a discrete colour palette in a continuous scale.\n Consider using type = \" seq\" or type = \" div\" instead" , call. = FALSE )
97
98
}
98
99
continuous_scale(aesthetics , " distiller" ,
99
- gradient_n_pal(brewer_pal(type , palette , direction )(6 ), values , space ), na.value = na.value , guide = guide , ... )
100
+ gradient_n_pal(brewer_pal(type , palette , direction )(7 ), values , space ), na.value = na.value , guide = guide , ... )
100
101
}
101
102
102
103
# icon.brewer <- function() {
0 commit comments