ggplot2-scales: Scales to use for ggplot2

Description Usage Arguments Value Examples

Description

These functions provide the option to use the scico palettes along with the ggplot2 package. It goes without saying that it requires ggplot2 to work.

Usage

 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
scale_colour_scico(
  ...,
  alpha = NULL,
  begin = 0,
  end = 1,
  direction = 1,
  palette = "bilbao"
)

scale_color_scico(
  ...,
  alpha = NULL,
  begin = 0,
  end = 1,
  direction = 1,
  palette = "bilbao"
)

scale_fill_scico(
  ...,
  alpha = NULL,
  begin = 0,
  end = 1,
  direction = 1,
  palette = "bilbao"
)

scale_colour_scico_d(
  ...,
  alpha = 1,
  begin = 0,
  end = 1,
  direction = 1,
  palette = "batlow",
  aesthetics = "colour"
)

scale_color_scico_d(
  ...,
  alpha = 1,
  begin = 0,
  end = 1,
  direction = 1,
  palette = "batlow",
  aesthetics = "colour"
)

scale_fill_scico_d(
  ...,
  alpha = 1,
  begin = 0,
  end = 1,
  direction = 1,
  palette = "batlow",
  aesthetics = "fill"
)

Arguments

...

Arguments to pass on to ggplot2::scale_colour_gradientn(), ggplot2::scale_fill_gradientn(), ggplot2::ggplot2::discrete_scale()

alpha

The opacity of the generated colours. If specified rgba values will be generated. The default (NULL) will generate rgb values which corresponds to alpha = 1

begin

The interval within the palette to sample colours from. Defaults to 0 and 1 respectively

end

The interval within the palette to sample colours from. Defaults to 0 and 1 respectively

direction

Either 1 or -1. If -1 the palette will be reversed

palette

The name of the palette to sample from. See scico_palette_names() for a list of possible names

aesthetics

Character string or vector of character strings listing the name(s) of the aesthetic(s) that this scale works with. This can be useful, for example, to apply colour settings to the colour and fill aesthetics at the same time, via aesthetics = c("colour", "fill").

Value

A ScaleContinuous or ScaleDiscrete object that can be added to a ggplot object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
if (require('ggplot2')) {
  volcano <- data.frame(
    x = rep(seq_len(ncol(volcano)), each = nrow(volcano)),
    y = rep(seq_len(nrow(volcano)), ncol(volcano)),
    height = as.vector(volcano)
  )
  
  ggplot(volcano, aes(x = x, y = y, fill = height)) + 
    geom_raster() + 
    scale_fill_scico(palette = 'tokyo') 
    
  ggplot(iris, aes(x=Petal.Width, y=Petal.Length)) +
    geom_point(aes(color=Species), size=10) + 
    scale_colour_scico_d() 
}

scico documentation built on July 1, 2020, 10:20 p.m.