diff --git a/404.html b/404.html index 2baa8bb..9157dbe 100644 --- a/404.html +++ b/404.html @@ -6,18 +6,11 @@ Page not found (404) • gguidance - - - - - - - - + + - License • gguidanceLicense • gguidance @@ -10,7 +10,7 @@ gguidance - 0.0.0.9000 + 0.0.0.9001 + + + + + +
+
+
+ +
+

These functions construct various sorts of caps. They construct a matrix +that can be supplied as the shape argument in gizmo_barcap().

+
+ +
+

Usage

+
cap_triangle()
+
+cap_round(n = 100)
+
+cap_arch(n = 100)
+
+cap_ogee(n = 100)
+
+cap_none()
+
+ +
+

Arguments

+
n
+

An <integer[n]> number of points to use for the cap.

+ +
+
+

Value

+ + +

A <matrix[n, 2]> with coordinates for points on the brackets.

+
+
+

Details

+

When designing custom cap shapes, the expectation is that the first point +starts at the (0, 0) coordinate and the last point ends at the (0, 1) +coordinate. The first column follows the orthogonal direction of the bar +whereas the second column follows the direction of the bar.

+
+
+

Functions

+ +
  • cap_triangle(): An equilateral triangle with n = 3 points.

  • +
  • cap_round(): A semicircle.

  • +
  • cap_arch(): Two circular arcs forming an equilateral Gothic arch.

  • +
  • cap_ogee(): Four circular arcs forming an 'ogee' arch.

  • +
  • cap_none(): No cap.

  • +
+ +
+

Examples

+
plot(cap_arch(), type = 'l')
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/common_parameters.html b/reference/common_parameters.html new file mode 100644 index 0000000..81fc975 --- /dev/null +++ b/reference/common_parameters.html @@ -0,0 +1,117 @@ + +common parameters in gguidance — common_parameters • gguidance + Skip to contents + + +
+
+
+ +
+

This is a collection of common parameters so they needn't be re-documented +each time.

+
+ + +
+

Arguments

+
title
+

A <character[1]> or <expression[1]> indicating the title of +the guide. If NULL, the title is not shown. The default, +waiver(), takes the name of the scale object or +the name specified in labs() as the title.

+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ + +
order
+

A positive <integer[1]> that specifies the order of this guide among +multiple guides. This controls in which order guides are merged if there +are multiple guides for the same position. If 0 (default), the order is +determined by a hashing indicative settings of a guide.

+ + +
available_aes
+

A <character> vector listing the aesthetics for which this guide can +be build.

+ + +
direction
+

A <character[1]> indicating the direction of the guide. Can be on of +"horizontal" or "vertical".

+ + +
angle
+

A specification for the text angle. Compared to setting the angle argument +in element_text(), this argument uses some +heuristics to automatically pick the hjust and vjust that you +probably want. Can be one of the following:

  • NULL to take angles and justification settings directly from the theme.

  • +
  • waiver() to allow reasonable defaults in special +cases.

  • +
  • A <numeric[1]> between -360 and 360 for the text angle in degrees.

  • +
+ +
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/compose_crux.html b/reference/compose_crux.html new file mode 100644 index 0000000..cd0c919 --- /dev/null +++ b/reference/compose_crux.html @@ -0,0 +1,180 @@ + +Compose guides in a cross — compose_crux • gguidance + Skip to contents + + +
+
+
+ +
+

This guide composition has a central guide optionally surrounded by other +guides on all four sides.

+
+ +
+

Usage

+
compose_crux(
+  key = NULL,
+  centre = "none",
+  left = "none",
+  right = "none",
+  top = "none",
+  bottom = "none",
+  args = list(),
+  complete = FALSE,
+  theme = NULL,
+  theme_defaults = list(),
+  reverse = FALSE,
+  order = 0,
+  title = waiver(),
+  position = waiver(),
+  available_aes = NULL
+)
+
+ +
+

Arguments

+
key
+

A standard key specification. The key is shared +among all guides that have NULL keys themselves. See more information +in the linked topic.

+ + +
centre, left, right, top, bottom
+

Guides to use in +composition per position. Each guide can be +specified as one of the following:

  • A <Guide> class object.

  • +
  • A <function> that returns a <Guide> class object.

  • +
  • A <character> naming such a function, without the guide_ or +primitive_ prefix.

  • +
+ + +
args
+

A <list> of arguments to pass to guides that are given either +as a function or as a string.

+ + +
complete
+

A <logical[1]> whether to treat the composition as a +complete guide. If TRUE, a title and margin are added to the result. +If FALSE (default), no titles and margins are added.

+ + +
theme
+

A <theme> object to style the guide +individually of differently from the plot's theme settings. The theme +arguments in the guide overrides, and is combined with, the plot's theme.

+ + +
theme_defaults
+

A <list> of theme elements to override undeclared +theme arguments.

+ + +
reverse
+

A <logical[1]> whether to reverse continuous guides. +If TRUE, guides like colour bars are flipped. If FALSE (default), +the original order is maintained.

+ + +
order
+

A positive <integer[1]> that specifies the order of this guide among +multiple guides. This controls in which order guides are merged if there +are multiple guides for the same position. If 0 (default), the order is +determined by a hashing indicative settings of a guide.

+ + +
title
+

A <character[1]> or <expression[1]> indicating the title of +the guide. If NULL, the title is not shown. The default, +waiver(), takes the name of the scale object or +the name specified in labs() as the title.

+ + +
position
+

Where this guide should be drawn: one of "top", "bottom", +"left", or "right".

+ + +
available_aes
+

A <character> vector listing the aesthetics for which this guide can +be build.

+ +
+
+

Value

+ + +

A <ComposeCrux> guide object.

+
+
+

See also

+ +
+ +
+

Examples

+
NULL
+#> NULL
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/compose_ontop-1.png b/reference/compose_ontop-1.png new file mode 100644 index 0000000..e3011cb Binary files /dev/null and b/reference/compose_ontop-1.png differ diff --git a/reference/compose_ontop.html b/reference/compose_ontop.html new file mode 100644 index 0000000..e0745fb --- /dev/null +++ b/reference/compose_ontop.html @@ -0,0 +1,183 @@ + +Compose guides on top of one another — compose_ontop • gguidance + Skip to contents + + +
+
+
+ +
+

This guide can place place other guides on top of one another.

+
+ +
+

Usage

+
compose_ontop(
+  ...,
+  args = list(),
+  key = NULL,
+  title = waiver(),
+  angle = waiver(),
+  theme = NULL,
+  order = 0,
+  position = waiver(),
+  available_aes = NULL
+)
+
+ +
+

Arguments

+
...
+

Guides to stack in composition. Each guide +can be specified as one of the following:

  • A <Guide> class object.

  • +
  • A <function> that returns a <Guide> class object.

  • +
  • A <character[1]> naming such a function, without the guide_ or +primitive_ prefix.

  • +
+ + +
args
+

A <list> of arguments to pass to guides that are given either +as a function or as a string.

+ + +
key
+

A standard key specification. The key is shared +among all guides that have NULL keys themselves. See more information +in the linked topic.

+ + +
title
+

A <character[1]> or <expression[1]> indicating the title of +the guide. If NULL, the title is not shown. The default, +waiver(), takes the name of the scale object or +the name specified in labs() as the title.

+ + +
angle
+

A specification for the text angle. Compared to setting the angle argument +in element_text(), this argument uses some +heuristics to automatically pick the hjust and vjust that you +probably want. Can be one of the following:

  • NULL to take angles and justification settings directly from the theme.

  • +
  • waiver() to allow reasonable defaults in special +cases.

  • +
  • A <numeric[1]> between -360 and 360 for the text angle in degrees.

  • +
+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
order
+

A positive <integer[1]> that specifies the order of this guide among +multiple guides. This controls in which order guides are merged if there +are multiple guides for the same position. If 0 (default), the order is +determined by a hashing indicative settings of a guide.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ + +
available_aes
+

A <character> giving aesthetics that must match the +the guides.

+ +
+
+

Value

+ + +

A <ComposeOntop> composite guide object.

+
+
+

See also

+ +
+ +
+

Examples

+
# Using the ontop composition to get two types of ticks with different
+# lengths
+ggplot(mpg, aes(displ, hwy)) +
+  geom_point() +
+  guides(x = compose_ontop(
+    guide_axis_custom(
+      key_manual(c(2, 4, 6)),
+      theme = theme(
+        axis.ticks = element_line(colour = "limegreen"),
+        axis.ticks.length = unit(11, "pt")
+      )
+    ),
+    guide_axis_custom(
+      key_manual(c(3, 5, 7)),
+      theme = theme(
+        axis.ticks = element_line(colour = "tomato"),
+        axis.ticks.length = unit(5.5, "pt")
+      )
+    )
+  ))
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/compose_sandwich-1.png b/reference/compose_sandwich-1.png new file mode 100644 index 0000000..ddb4b0e Binary files /dev/null and b/reference/compose_sandwich-1.png differ diff --git a/reference/compose_sandwich.html b/reference/compose_sandwich.html new file mode 100644 index 0000000..7cd2b91 --- /dev/null +++ b/reference/compose_sandwich.html @@ -0,0 +1,194 @@ + +Compose guides as a sandwich — compose_sandwich • gguidance + Skip to contents + + +
+
+
+ +
+

This guide composition has a middle guide flanked by two parallel guides.

+
+ +
+

Usage

+
compose_sandwich(
+  key = key_auto(),
+  middle = gizmo_barcap(),
+  text = "none",
+  opposite = "none",
+  args = list(),
+  complete = TRUE,
+  theme = NULL,
+  theme_defaults = list(),
+  reverse = FALSE,
+  order = 0,
+  title = waiver(),
+  position = waiver(),
+  available_aes = NULL
+)
+
+ +
+

Arguments

+
key
+

A standard key specification. The key is shared +among all guides that have NULL keys themselves. See more information +in the linked topic.

+ + +
middle
+

Guide to use as the middle guide. Each guide can be specified +as one of the following:

  • A <Guide> class object.

  • +
  • A <function> that returns a <Guide> class object.

  • +
  • A <character> naming such a function, without the guide_ or +primitive_ prefix.

  • +
+ + +
text, opposite
+

Guides to use at the legend.text.position location +and on the opposite side of the middle guide respectively. Guide +specification is the same as in the middle argument.

+ + +
args
+

A <list> of arguments to pass to guides that are given either +as a function or as a string.

+ + +
complete
+

A <logical[1]> whether to treat the composition as a +complete guide. If TRUE, a title and margin are added to the result. +If FALSE (default), no titles and margins are added.

+ + +
theme
+

A <theme> object to style the guide +individually of differently from the plot's theme settings. The theme +arguments in the guide overrides, and is combined with, the plot's theme.

+ + +
theme_defaults
+

A <list> of theme elements to override undeclared +theme arguments.

+ + +
reverse
+

A <logical[1]> whether to reverse continuous guides. +If TRUE, guides like colour bars are flipped. If FALSE (default), +the original order is maintained.

+ + +
order
+

A positive <integer[1]> that specifies the order of this guide among +multiple guides. This controls in which order guides are merged if there +are multiple guides for the same position. If 0 (default), the order is +determined by a hashing indicative settings of a guide.

+ + +
title
+

A <character[1]> or <expression[1]> indicating the title of +the guide. If NULL, the title is not shown. The default, +waiver(), takes the name of the scale object or +the name specified in labs() as the title.

+ + +
position
+

Where this guide should be drawn: one of "top", "bottom", +"left", or "right".

+ + +
available_aes
+

A <character> vector listing the aesthetics for which this guide can +be build.

+ +
+
+

Value

+ + +

A <ComposeSandwich> guide object.

+
+
+

Details

+

The sandwich composition is effectively the same as a +crux composition lacking two opposing arms.

+
+
+

See also

+ +
+ +
+

Examples

+
# A standard plot with a sandwich guide
+ggplot(mpg, aes(displ, hwy)) +
+  geom_point(aes(colour = cty)) +
+  guides(colour = compose_sandwich(
+    middle = "colourbar",
+    text = "axis_custom",
+    opposite = primitive_bracket(key = key_range_manual(
+      start = c(10, 20), end = c(25, 30), name = c("A", "B")
+    ))
+  ))
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/compose_stack-1.png b/reference/compose_stack-1.png new file mode 100644 index 0000000..11c6791 Binary files /dev/null and b/reference/compose_stack-1.png differ diff --git a/reference/compose_stack.html b/reference/compose_stack.html new file mode 100644 index 0000000..bc4bfe8 --- /dev/null +++ b/reference/compose_stack.html @@ -0,0 +1,186 @@ + +Compose guides as stack — compose_stack • gguidance + Skip to contents + + +
+
+
+ +
+

This guide can stack other guides.

+
+ +
+

Usage

+
compose_stack(
+  ...,
+  args = list(),
+  key = NULL,
+  title = waiver(),
+  side.titles = waiver(),
+  angle = waiver(),
+  theme = NULL,
+  order = 0,
+  drop = NULL,
+  position = waiver(),
+  available_aes = NULL
+)
+
+ +
+

Arguments

+
...
+

Guides to stack in composition. Each guide +can be specified as one of the following:

  • A <Guide> class object.

  • +
  • A <function> that returns a <Guide> class object.

  • +
  • A <character[1]> naming such a function, without the guide_ or +primitive_ prefix.

  • +
+ + +
args
+

A <list> of arguments to pass to guides that are given either +as a function or as a string.

+ + +
key
+

A standard key specification. The key is shared +among all guides that have NULL keys themselves. See more information +in the linked topic.

+ + +
title
+

A <character[1]> or <expression[1]> indicating the title of +the guide. If NULL, the title is not shown. The default, +waiver(), takes the name of the scale object or +the name specified in labs() as the title.

+ + +
side.titles
+

A <character> giving labels for titles displayed on the +side of the stack. Set to NULL to display no side titles. If waiver(), +an attempt is made to extract the titles from the guides and use these +as side titles.

+ + +
angle
+

A specification for the text angle. Compared to setting the angle argument +in element_text(), this argument uses some +heuristics to automatically pick the hjust and vjust that you +probably want. Can be one of the following:

  • NULL to take angles and justification settings directly from the theme.

  • +
  • waiver() to allow reasonable defaults in special +cases.

  • +
  • A <numeric[1]> between -360 and 360 for the text angle in degrees.

  • +
+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
order
+

A positive <integer[1]> that specifies the order of this guide among +multiple guides. This controls in which order guides are merged if there +are multiple guides for the same position. If 0 (default), the order is +determined by a hashing indicative settings of a guide.

+ + +
drop
+

An <integer> giving the indices of guides that should be +dropped when a facet requests no labels to be drawn at axes in between +panels. The default, NULL, will drop every guide except the first.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ + +
available_aes
+

A <character> giving aesthetics that must match the +the guides.

+ +
+
+

Value

+ + +

A <ComposeStack> guide object.

+
+
+

See also

+ +
+ +
+

Examples

+
ggplot() +
+  geom_function(fun = dnorm, xlim = c(-3, 3)) +
+  guides(x = compose_stack(
+    "axis", "axis",
+    side.titles = c("first", "second")
+  )) +
+  # Add margin to make room for side titles
+  theme(plot.margin = margin(5.5, 5.5, 5.5, 11))
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/figures/README-composition-1.svg b/reference/figures/README-composition-1.svg new file mode 100644 index 0000000..2e0a12b --- /dev/null +++ b/reference/figures/README-composition-1.svg @@ -0,0 +1,352 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +20 +30 +40 + + + + + + + + + + +2 +3 +4 +5 +6 +7 +Engine displacement +Highway miles per gallon +City miles +per gallon + + + + + + + + + + + + + + + + + + + + + + + + +Efficient + + + + + + + + +10 +15 +20 +25 +30 +35 + + diff --git a/reference/figures/README-full_guides-1.svg b/reference/figures/README-full_guides-1.svg new file mode 100644 index 0000000..b9f0e1e --- /dev/null +++ b/reference/figures/README-full_guides-1.svg @@ -0,0 +1,351 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +20 +30 +40 + + + + + + + + + + +2 +3 +4 +5 +6 +7 +Engine displacement +Highway miles per gallon +City miles +per gallon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +10 +15 +20 +25 +30 + + diff --git a/reference/figures/README-primitives-1.svg b/reference/figures/README-primitives-1.svg new file mode 100644 index 0000000..a431430 --- /dev/null +++ b/reference/figures/README-primitives-1.svg @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +20 +30 +40 + + + +Efficient + + + + + + + + +2 +3 +4 +5 +6 +7 +Engine displacement +Highway miles per gallon + +City miles +per gallon + + + + + + + + + + + + + +10 +15 +20 +25 +30 +35 + + diff --git a/reference/gguidance-package.html b/reference/gguidance-package.html index 0daace8..400b480 100644 --- a/reference/gguidance-package.html +++ b/reference/gguidance-package.html @@ -1,7 +1,5 @@ -gguidance: Extended guide options for 'ggplot2' — gguidance-package • gguidancegguidance: Extended guide options for 'ggplot2' — gguidance-package • gguidance @@ -12,7 +10,7 @@ gguidance - 0.0.0.9000 + 0.0.0.9001 + + + + + +
+
+
+ +
+

This guide displays a colour bar with optional caps at either ends of +the bar.

+
+ +
+

Usage

+
gizmo_barcap(
+  key = "sequence",
+  shape = "triangle",
+  size = NULL,
+  show = NA,
+  alpha = NA,
+  oob = "keep",
+  theme = NULL,
+  position = waiver(),
+  direction = NULL
+)
+
+ +
+

Arguments

+
key
+

A sequence key specification. Defaults to +key_sequence(n = 15). Changing the argument to +key_sequence() is fine, but changing the key type is not advised.

+ + +
shape
+

A cap specification by providing one of the +following:

  • A cap <function>, such as cap_triangle().

  • +
  • A <character[1]> naming a cap function without the 'cap_'-prefix, +e.g. "round".

  • +
  • A two column <matrix[n, 2]> giving coordinates for a cap, like those +created by cap functions such as cap_arch().

  • +
+ + +
size
+

A <unit> setting the size of the cap. When +NULL (default), cap size will be proportional to the shape coordinates +and the legend.key.size theme setting.

+ + +
show
+

A <logical> to control how caps are displayed at the ends +of the bar. When TRUE, caps are always displayed. When FALSE, caps +are never displayed. When NA (default), caps are displayed when the +data range exceed the limits. When given as <logical[2]>, show[1] +controls the display at the lower end and show[2] at the upper end.

+ + +
alpha
+

A <numeric[1]> between 0 and 1 setting the colour transparency +of the bar. Use NA to preserve the alpha encoded in the colour itself.

+ + +
oob
+

An out-of-bounds handling function that affects the cap colour. +Can be one of the following:

  • A <function> like oob_squish.

  • +
  • A <character[1]> naming such a function without the 'oob'-prefix, +such as "keep".

  • +
+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ + +
direction
+

A <character[1]> indicating the direction of the guide. Can be on of +"horizontal" or "vertical".

+ +
+
+

Value

+ + +

A <GizmoBarcap> object.

+
+
+

See also

+ +
+ +
+

Examples

+
# A standard plot
+p <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
+  geom_point()
+
+# Just a bar
+p + scale_colour_viridis_c(guide = gizmo_barcap())
+
+
+# Caps show up when there is data outside the limits
+p + scale_colour_viridis_c(
+  limits = c(10, 30),
+  guide  = gizmo_barcap()
+)
+
+
+# The scale's out-of-bounds handler determines cap colour
+p + scale_colour_viridis_c(
+  limits = c(10, 30), oob = scales::oob_squish,
+  guide = gizmo_barcap()
+)
+
+
+# Customising display of the guide
+p +
+  scale_colour_viridis_c(
+    oob = scales::oob_squish,
+    guide = gizmo_barcap(
+      shape = "arch", show = c(FALSE, TRUE),
+      size = unit(2, "cm"),
+      theme = theme(legend.key.height = unit(4, "cm"))
+    )
+  ) +
+  theme(
+    legend.frame = element_rect(colour = "black"),
+    legend.key.width = unit(0.5, "cm")
+  )
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/gizmo_density-1.png b/reference/gizmo_density-1.png new file mode 100644 index 0000000..dc2e504 Binary files /dev/null and b/reference/gizmo_density-1.png differ diff --git a/reference/gizmo_density-2.png b/reference/gizmo_density-2.png new file mode 100644 index 0000000..b18ee3d Binary files /dev/null and b/reference/gizmo_density-2.png differ diff --git a/reference/gizmo_density-3.png b/reference/gizmo_density-3.png new file mode 100644 index 0000000..a70acb7 Binary files /dev/null and b/reference/gizmo_density-3.png differ diff --git a/reference/gizmo_density-4.png b/reference/gizmo_density-4.png new file mode 100644 index 0000000..09ada65 Binary files /dev/null and b/reference/gizmo_density-4.png differ diff --git a/reference/gizmo_density-5.png b/reference/gizmo_density-5.png new file mode 100644 index 0000000..09ada65 Binary files /dev/null and b/reference/gizmo_density-5.png differ diff --git a/reference/gizmo_density.html b/reference/gizmo_density.html new file mode 100644 index 0000000..32b2481 --- /dev/null +++ b/reference/gizmo_density.html @@ -0,0 +1,195 @@ + +Guide gizmo: kernel density estimate — gizmo_density • gguidance + Skip to contents + + +
+
+
+ +
+

This guide displays a kernel density estimate (KDE) of the aesthetic. If the +aesthetic is colour or fill, the shape will reflect this.

+
+ +
+

Usage

+
gizmo_density(
+  key = "sequence",
+  density = NULL,
+  density.args = list(),
+  density.fun = stats::density,
+  just = 0.5,
+  oob = "keep",
+  alpha = NA,
+  theme = NULL,
+  position = waiver(),
+  direction = NULL
+)
+
+ +
+

Arguments

+
key
+

A sequence key or binned key +specification.

+ + +
density
+

One of the following:

  • NULL for using kernel density estimation on the data values (default).

  • +
  • a <numeric> vector to feed to the density.fun function.

  • +
  • A named <list> with x and y numeric elements of equal length, such +as one returned by using the density() function. +Please note that <list> input is expected in scale-transformed space, +not original data space.

  • +
+ + +
density.args
+

A <list> with additional arguments to the +density.fun argument. Only applies when density is not provided as a +<list>. already.

+ + +
density.fun
+

A <function> to use for kernel density estimation when +the density argument is not provided as a list already.

+ + +
just
+

A <numeric[1]> between 0 and 1. Use 0 for bottom- or +left-aligned densities, use 1 for top- or right-aligned densities and 0.5 +for violin shapes.

+ + +
oob
+

An out-of-bounds handling function that affects the cap colour. +Can be one of the following:

  • A <function> like oob_squish.

  • +
  • A <character[1]> naming such a function without the 'oob'-prefix, +such as "keep".

  • +
+ + +
alpha
+

A <numeric[1]> between 0 and 1 setting the colour transparency +of the bar. Use NA to preserve the alpha encoded in the colour itself.

+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ + +
direction
+

A <character[1]> indicating the direction of the guide. Can be on of +"horizontal" or "vertical".

+ +
+
+

Value

+ + +

A <GizmoDensity> object.

+
+
+

Details

+

Non-finite values such as NA and NaN are ignored while infinite values +such as -Inf and Inf are squished to the limits.

+
+
+

See also

+ +
+ +
+

Examples

+
# A standard plot
+p <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
+  geom_point() +
+  scale_colour_viridis_c()
+
+# Density from plot data
+p + guides(colour = gizmo_density())
+
+
+# Using bins instead of gradient
+p + guides(colour = gizmo_density("bins"))
+
+
+# Providing custom values to compute density of
+p + guides(colour = gizmo_density(density = runif(1000, min = 5, max = 35)))
+
+
+# Providing a precomputed density
+p + guides(colour = gizmo_density(density = density(mpg$cty, adjust = 0.5)))
+
+
+# Alternatively, parameters may be passed through density.args
+p + guides(colour = gizmo_density(density.args = list(adjust = 0.5)))
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/gizmo_grob-1.png b/reference/gizmo_grob-1.png new file mode 100644 index 0000000..6dd71da Binary files /dev/null and b/reference/gizmo_grob-1.png differ diff --git a/reference/gizmo_grob.html b/reference/gizmo_grob.html new file mode 100644 index 0000000..452cc49 --- /dev/null +++ b/reference/gizmo_grob.html @@ -0,0 +1,133 @@ + +Guide gizmo: custom grob — gizmo_grob • gguidance + Skip to contents + + +
+
+
+ +
+

This guide displays a user-provided grob.

+
+ +
+

Usage

+
gizmo_grob(
+  grob,
+  width = grobWidth(grob),
+  height = grobHeight(grob),
+  hjust = 0.5,
+  vjust = 0.5,
+  position = waiver()
+)
+
+ +
+

Arguments

+
grob
+

A <grob> to display.

+ + +
width, height
+

A [<unit[1]>][grid::unit] setting the allocated +width and height of the the grob respectively.

+ + +
hjust, vjust
+

A <numeric[1]> between 0 and 1 setting the horizontal +and vertical justification of the grob when used as a guide for the x +and y aesthetics.

+ + +
position
+

Where this guide should be drawn: one of "top", "bottom", +"left", or "right".

+ +
+
+

Value

+ + +

A <GizmoGrob> object.

+
+
+

See also

+ +
+ +
+

Examples

+
circle <- grid::circleGrob()
+
+# A standard plot with grob gizmos
+ggplot(mpg, aes(displ, hwy, colour = cty)) +
+  geom_point() +
+  guides(
+    x.sec = gizmo_grob(
+      circle, hjust = 0.75,
+      width = unit(2, "cm"), height = unit(2, "cm")
+    ),
+    colour = gizmo_grob(
+      circle, width = unit(1, "cm"), height = unit(1, "cm")
+    )
+  )
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/gizmo_histogram-1.png b/reference/gizmo_histogram-1.png new file mode 100644 index 0000000..405c607 Binary files /dev/null and b/reference/gizmo_histogram-1.png differ diff --git a/reference/gizmo_histogram-2.png b/reference/gizmo_histogram-2.png new file mode 100644 index 0000000..0ee4677 Binary files /dev/null and b/reference/gizmo_histogram-2.png differ diff --git a/reference/gizmo_histogram-3.png b/reference/gizmo_histogram-3.png new file mode 100644 index 0000000..9995daa Binary files /dev/null and b/reference/gizmo_histogram-3.png differ diff --git a/reference/gizmo_histogram-4.png b/reference/gizmo_histogram-4.png new file mode 100644 index 0000000..ef3434f Binary files /dev/null and b/reference/gizmo_histogram-4.png differ diff --git a/reference/gizmo_histogram-5.png b/reference/gizmo_histogram-5.png new file mode 100644 index 0000000..ef3434f Binary files /dev/null and b/reference/gizmo_histogram-5.png differ diff --git a/reference/gizmo_histogram.html b/reference/gizmo_histogram.html new file mode 100644 index 0000000..558b8ee --- /dev/null +++ b/reference/gizmo_histogram.html @@ -0,0 +1,195 @@ + +Guide gizmo: histogram — gizmo_histogram • gguidance + Skip to contents + + +
+
+
+ +
+

This guide displays a histogram of the aesthetic. If the aesthetic is +colour or fill, the shape will reflect this.

+
+ +
+

Usage

+
gizmo_histogram(
+  key = "sequence",
+  hist = NULL,
+  hist.args = list(),
+  hist.fun = graphics::hist,
+  just = 1,
+  oob = oob_keep,
+  alpha = NA,
+  theme = NULL,
+  position = waiver(),
+  direction = NULL
+)
+
+ +
+

Arguments

+
key
+

A sequence key or binned key +specification.

+ + +
hist
+

One of the following:

  • NULL for computing histograms on the data values (default).

  • +
  • an atomic <vector> to feed to the hist.fun function.

  • +
  • A named <list> with breaks and counts numeric items, where the +breaks item is exactly one element longer than the counts item. A +typical way to construct such list is using the hist() +function. Please note that <list> input is expected in scale-transformed +space, not original data space.

  • +
+ + +
hist.args
+

A <list> with additional arguments to the hist.fun +argument. Only applies when hist is not provided as a <list> already.

+ + +
hist.fun
+

A <function> to use for computing histograms when the +hist argument is not provided as a list already.

+ + +
just
+

A <numeric[1]> between 0 and 1. Use 0 for bottom- or +left-aligned histograms, use 1 for top- or right-aligned histograms and 0.5 +for centred histograms.

+ + +
oob
+

An out-of-bounds handling function that affects the cap colour. +Can be one of the following:

  • A <function> like oob_squish.

  • +
  • A <character[1]> naming such a function without the 'oob'-prefix, +such as "keep".

  • +
+ + +
alpha
+

A <numeric[1]> between 0 and 1 setting the colour transparency +of the bar. Use NA to preserve the alpha encoded in the colour itself.

+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ + +
direction
+

A <character[1]> indicating the direction of the guide. Can be on of +"horizontal" or "vertical".

+ +
+
+

Value

+ + +

A <GizmoHistogram> object.

+
+
+

Details

+

Non-finite values such as NA and NaN are ignored while infinite values +such as -Inf and Inf are squished to the limits.

+
+
+

See also

+

Other gizmos: +gizmo_barcap(), +gizmo_density(), +gizmo_grob(), +gizmo_stepcap()

+
+ +
+

Examples

+
# A standard plot
+p <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
+  geom_point() +
+  scale_colour_viridis_c()
+
+# Histogram from plot data
+p + guides(colour = gizmo_histogram())
+
+
+# Using bins instead of gradient
+p + guides(colour = gizmo_histogram("bins"))
+
+
+# Providing custom values to compute histogram
+p + guides(colour = gizmo_histogram(hist = runif(1000, min = 5, max = 35)))
+
+
+# Providing precomputed histogram
+p + guides(colour = gizmo_histogram(hist = hist(mpg$cty, breaks = 10)))
+
+
+# Alternatively, parameters may be passed through hist.args
+p + guides(colour = gizmo_histogram(hist.arg = list(breaks = 10)))
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/gizmo_stepcap-1.png b/reference/gizmo_stepcap-1.png new file mode 100644 index 0000000..b1b8965 Binary files /dev/null and b/reference/gizmo_stepcap-1.png differ diff --git a/reference/gizmo_stepcap-2.png b/reference/gizmo_stepcap-2.png new file mode 100644 index 0000000..243e82c Binary files /dev/null and b/reference/gizmo_stepcap-2.png differ diff --git a/reference/gizmo_stepcap-3.png b/reference/gizmo_stepcap-3.png new file mode 100644 index 0000000..a40ab9b Binary files /dev/null and b/reference/gizmo_stepcap-3.png differ diff --git a/reference/gizmo_stepcap-4.png b/reference/gizmo_stepcap-4.png new file mode 100644 index 0000000..5beb2a3 Binary files /dev/null and b/reference/gizmo_stepcap-4.png differ diff --git a/reference/gizmo_stepcap.html b/reference/gizmo_stepcap.html new file mode 100644 index 0000000..18c7f07 --- /dev/null +++ b/reference/gizmo_stepcap.html @@ -0,0 +1,201 @@ + +Guide gizmo: capped colour steps — gizmo_stepcap • gguidance + Skip to contents + + +
+
+
+ +
+

This guide displays a binned variant of the colour bar with optional caps at +either ends of the bar.

+
+ +
+

Usage

+
gizmo_stepcap(
+  key = "bins",
+  shape = "triangle",
+  size = NULL,
+  show = NA,
+  alpha = NA,
+  oob = "keep",
+  theme = NULL,
+  position = waiver(),
+  direction = NULL
+)
+
+ +
+

Arguments

+
key
+

A bins key specificiation. Defaults to +key_bins(even.steps = FALSE, show.limits = NULL). Changing the +arguments to key_bins() is fine, but changing the key type is not +advised.

+ + +
shape
+

A cap specification by providing one of the +following:

  • A cap <function>, such as cap_triangle().

  • +
  • A <character[1]> naming a cap function without the 'cap_'-prefix, +e.g. "round".

  • +
  • A two column <matrix[n, 2]> giving coordinates for a cap, like those +created by cap functions such as cap_arch().

  • +
+ + +
size
+

A <unit> setting the size of the cap. When +NULL (default), cap size will be proportional to the shape coordinates +and the legend.key.size theme setting.

+ + +
show
+

A <logical> to control how caps are displayed at the ends +of the bar. When TRUE, caps are always displayed. When FALSE, caps +are never displayed. When NA (default), caps are displayed when the +data range exceed the limits. When given as <logical[2]>, show[1] +controls the display at the lower end and show[2] at the upper end.

+ + +
alpha
+

A <numeric[1]> between 0 and 1 setting the colour transparency +of the bar. Use NA to preserve the alpha encoded in the colour itself.

+ + +
oob
+

An out-of-bounds handling function that affects the cap colour. +Can be one of the following:

  • A <function> like oob_squish.

  • +
  • A <character[1]> naming such a function without the 'oob'-prefix, +such as "keep".

  • +
+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ + +
direction
+

A <character[1]> indicating the direction of the guide. Can be on of +"horizontal" or "vertical".

+ +
+
+

Value

+ + +

A GizmoStepcap object.

+
+
+

See also

+ +
+ +
+

Examples

+
# A standard plot
+p <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
+  geom_point()
+
+# Just some recangles
+p + scale_colour_viridis_c(guide = gizmo_stepcap())
+
+
+# Caps show up when there is data outside the limits
+p + scale_colour_viridis_c(
+  limits = c(10, 30),
+  guide = gizmo_stepcap()
+)
+
+
+# The scale's out-of-bounds handler determines cap colour
+p + scale_colour_viridis_c(
+  limits = c(10, 30), oob = scales::oob_squish,
+  guide = gizmo_stepcap()
+)
+
+
+# Customising the display of the guide
+p +
+  scale_colour_viridis_c(
+    oob = scales::oob_squish,
+    guide = gizmo_stepcap(
+      shape = "round", show = c(FALSE, TRUE),
+      size = unit(1, "cm"),
+      theme = theme(legend.key.height = unit(4, "cm"))
+    )
+  ) +
+  theme(
+    legend.frame = element_rect(colour = "black"),
+    legend.key.width = unit(0.5, "cm")
+  )
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/guide-composition.html b/reference/guide-composition.html new file mode 100644 index 0000000..2c52df4 --- /dev/null +++ b/reference/guide-composition.html @@ -0,0 +1,138 @@ + +Guide composition — guide-composition • gguidance + Skip to contents + + +
+
+
+ +
+

Guide composition is a meta-guide orchestrating an ensemble of other guides. +On their own, a 'composing' guide is not very useful as a visual reflection +of a scale.

+
+ +
+

Usage

+
new_compose(
+  guides,
+  args = list(),
+  ...,
+  available_aes = c("any", "x", "y", "r", "theta"),
+  call = caller_env(),
+  super = Compose
+)
+
+ +
+

Arguments

+
guides
+

A <list> of guides wherein each element is one of the +following:

  • A <Guide> class object.

  • +
  • A <function> that returns a <Guide> class object.

  • +
  • A <character[1]> naming such a function, without the guide_ or +primitive_ prefix.

  • +
+ + +
args
+

A <list> of arguments to pass to guides that are given either +as a function or as a string.

+ + +
...
+

Additional parameters to pass on to +new_guide().

+ + +
available_aes
+

A <character> giving aesthetics that must match the +the guides.

+ + +
call
+

A call to display in messages.

+ + +
super
+

A <Compose> class object giving a meta-guide for composition.

+ +
+
+

Value

+ + +

A <Compose> (sub-)class guide that composes other guides.

+
+
+

See also

+

Other composition: +compose_crux(), +compose_ontop(), +compose_sandwich(), +compose_stack()

+
+ +
+

Examples

+
# new_compose() is not intended to be used directly
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/guide-gizmos.html b/reference/guide-gizmos.html new file mode 100644 index 0000000..632a32e --- /dev/null +++ b/reference/guide-gizmos.html @@ -0,0 +1,75 @@ + +Guide gizmos — guide-gizmos • gguidance + Skip to contents + + +
+
+
+ +
+

Guide gizmos are a speciality guide components that are very specific to +one or a few aesthetics to display.

+

Typically they can be composed with other guides or +guide primitives to form a complete guide.

+
+ + + +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/guide-primitives.html b/reference/guide-primitives.html new file mode 100644 index 0000000..a2bc798 --- /dev/null +++ b/reference/guide-primitives.html @@ -0,0 +1,81 @@ + +Guide primitives — guide-primitives • gguidance + Skip to contents + + +
+
+
+ +
+

Guide primitives are the building blocks of more complex guides. On their +own, they are not very useful as a visual reflection of a scale.

+

Their purpose is to be combined with one another to form a more complex, +complete guides that do reflect a scale in some way.

+
+ + +
+

Details

+

The guide primitives are simple, but flexible in that they are not tailored +for one particular aesthetic. That way they can be reused and combined +at will.

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/guide_axis_custom-1.png b/reference/guide_axis_custom-1.png new file mode 100644 index 0000000..9764130 Binary files /dev/null and b/reference/guide_axis_custom-1.png differ diff --git a/reference/guide_axis_custom-2.png b/reference/guide_axis_custom-2.png new file mode 100644 index 0000000..77c17d5 Binary files /dev/null and b/reference/guide_axis_custom-2.png differ diff --git a/reference/guide_axis_custom-3.png b/reference/guide_axis_custom-3.png new file mode 100644 index 0000000..35039a1 Binary files /dev/null and b/reference/guide_axis_custom-3.png differ diff --git a/reference/guide_axis_custom.html b/reference/guide_axis_custom.html new file mode 100644 index 0000000..0e4209d --- /dev/null +++ b/reference/guide_axis_custom.html @@ -0,0 +1,220 @@ + +Custom axis guide — guide_axis_custom • gguidance + Skip to contents + + +
+
+
+ +
+

This axis guide is a visual representation of position scales and can +represent the x, y, theta and r aesthetics. It differs from +guide_axis() in that it can accept custom keys +and is can act as an axis for coord_radial() like +guide_axis_theta().

+
+ +
+

Usage

+
guide_axis_custom(
+  key = NULL,
+  title = waiver(),
+  theme = NULL,
+  n.dodge = 1,
+  check.overlap = FALSE,
+  angle = waiver(),
+  cap = "none",
+  bidi = FALSE,
+  order = 0,
+  position = waiver()
+)
+
+ +
+

Arguments

+
key
+

A standard key specification. Defaults to +key_auto(). See more information in the linked topic and the 'Details' +section.

+ + +
title
+

A <character[1]> or <expression[1]> indicating the title of +the guide. If NULL, the title is not shown. The default, +waiver(), takes the name of the scale object or +the name specified in labs() as the title.

+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
n.dodge
+

An positive <integer[1]> setting the number of layers text +labels can occupy to avoid overlapping labels.

+ + +
check.overlap
+

A <logical[1]> indicating whether to check for and +omit overlapping text. If TRUE, first, last and middle labels are +recursively prioritised in that order. If FALSE, all labels are drawn.

+ + +
angle
+

A specification for the text angle. Compared to setting the angle argument +in element_text(), this argument uses some +heuristics to automatically pick the hjust and vjust that you +probably want. Can be one of the following:

  • NULL to take angles and justification settings directly from the theme.

  • +
  • waiver() to allow reasonable defaults in special +cases.

  • +
  • A <numeric[1]> between -360 and 360 for the text angle in degrees.

  • +
+ + +
cap
+

A method to cap the axes. One of the following:

  • A <character[1]> with one of the following:

    • "none" to perform no capping.

    • +
    • "both" to cap the line at both ends at the most extreme breaks.

    • +
    • "upper" to cap the line at the upper extreme break.

    • +
    • "lower" to cap the line at the lower extreme break.

    • +
  • +
  • A <logical>[1], where TRUE is equivalent to "both" and FALSE +is equivalent to "none" in the options above.

  • +
  • A sorted <numeric>[2n] with an even number of members. The lines +will be drawn between every odd-even pair.

  • +
  • A <function> that takes the scale's breaks as the first argument, the +scale's limits as the second argument and returns a <numeric>[2n] as +described above.

  • +
+ + +
bidi
+

A <logical[1]>: whether ticks should be drawn bidirectionally +(TRUE) or in a single direction (FALSE, default).

+ + +
order
+

A positive <integer[1]> that specifies the order of this guide among +multiple guides. This controls in which order guides are merged if there +are multiple guides for the same position. If 0 (default), the order is +determined by a hashing indicative settings of a guide.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ +
+
+

Value

+ + +

A <Guide> object.

+
+
+

Details

+

Under the hood, this guide is a stack composition of a +line, ticks and +labels primitives.

+

To set minor ticks, use key = "minor", or use the type argument in +key_manual() or key_map().

+

To use this as a logarithmic axis, set key = "log".

+
+
+

See also

+ +
+ +
+

Examples

+
# A standard plot with custom keys
+p <- ggplot(mpg, aes(displ, hwy)) +
+  geom_point() +
+  scale_x_continuous(
+    guide = guide_axis_custom(key = key_minor())
+  ) +
+  scale_y_continuous(
+    guide = guide_axis_custom(key = key_manual(c(20, 25, 30, 40)))
+  )
+p
+
+
+# Is translated to theta axis without fuss
+p + coord_radial()
+
+
+# To use as logarithmic axis:
+ggplot(msleep, aes(bodywt, brainwt)) +
+  geom_point(na.rm = TRUE) +
+  scale_x_continuous(
+    transform = "log10",
+    guide = guide_axis_custom("log")
+  )
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/guide_colourbar_custom-1.png b/reference/guide_colourbar_custom-1.png new file mode 100644 index 0000000..67015e3 Binary files /dev/null and b/reference/guide_colourbar_custom-1.png differ diff --git a/reference/guide_colourbar_custom-2.png b/reference/guide_colourbar_custom-2.png new file mode 100644 index 0000000..2009904 Binary files /dev/null and b/reference/guide_colourbar_custom-2.png differ diff --git a/reference/guide_colourbar_custom-3.png b/reference/guide_colourbar_custom-3.png new file mode 100644 index 0000000..388b2c2 Binary files /dev/null and b/reference/guide_colourbar_custom-3.png differ diff --git a/reference/guide_colourbar_custom-4.png b/reference/guide_colourbar_custom-4.png new file mode 100644 index 0000000..3389e2c Binary files /dev/null and b/reference/guide_colourbar_custom-4.png differ diff --git a/reference/guide_colourbar_custom-5.png b/reference/guide_colourbar_custom-5.png new file mode 100644 index 0000000..32ff937 Binary files /dev/null and b/reference/guide_colourbar_custom-5.png differ diff --git a/reference/guide_colourbar_custom.html b/reference/guide_colourbar_custom.html new file mode 100644 index 0000000..01ab5f7 --- /dev/null +++ b/reference/guide_colourbar_custom.html @@ -0,0 +1,252 @@ + +Custom colour bar guide — guide_colourbar_custom • gguidance + Skip to contents + + +
+
+
+ +
+

Similar to guide_colourbar(), this guide +displays continuous colour or fill aesthetics. It has additional options +to display caps at the end of the bar, depending on out-of-bounds values.

+
+ +
+

Usage

+
guide_colourbar_custom(
+  title = waiver(),
+  key = "auto",
+  first_guide = "axis_custom",
+  second_guide = first_guide,
+  shape = "triangle",
+  size = NULL,
+  show = NA,
+  nbin = 15,
+  alpha = NA,
+  reverse = FALSE,
+  oob = scales::oob_keep,
+  theme = NULL,
+  position = waiver(),
+  available_aes = c("colour", "fill")
+)
+
+ +
+

Arguments

+
title
+

A <character[1]> or <expression[1]> indicating the title of +the guide. If NULL, the title is not shown. The default, +waiver(), takes the name of the scale object or +the name specified in labs() as the title.

+ + +
key
+

A sequence key specification. Defaults to +key_sequence(n = 15). Changing the argument to +key_sequence() is fine, but changing the key type is not advised.

+ + +
first_guide, second_guide
+

Guides to flank the colour bar. Each guide +can be specified using one of the following:

  • A <Guide> class object.

  • +
  • A <function> that returns a <Guide> class object.

  • +
  • A <character> naming such a function, without the guide_ or +primitive_ prefix.

  • +

The first_guide will be placed at the location specified by the +legend.text.position theme setting. The second_guide will be placed +opposite that position. When second_guide has a label suppression +mechanism, no labels will be drawn for that guide.

+ + +
shape
+

A cap specification by providing one of the +following:

  • A cap <function>, such as cap_triangle().

  • +
  • A <character[1]> naming a cap function without the 'cap_'-prefix, +e.g. "round".

  • +
  • A two column <matrix[n, 2]> giving coordinates for a cap, like those +created by cap functions such as cap_arch().

  • +
+ + +
size
+

A <unit> setting the size of the cap. When +NULL (default), cap size will be proportional to the shape coordinates +and the legend.key.size theme setting.

+ + +
show
+

A <logical> to control how caps are displayed at the ends +of the bar. When TRUE, caps are always displayed. When FALSE, caps +are never displayed. When NA (default), caps are displayed when the +data range exceed the limits. When given as <logical[2]>, show[1] +controls the display at the lower end and show[2] at the upper end.

+ + +
nbin
+

A positive <integer[1]> determining how many colours to use +for the colour gradient.

+ + +
alpha
+

A <numeric[1]> between 0 and 1 setting the colour transparency +of the bar. Use NA to preserve the alpha encoded in the colour itself.

+ + +
reverse
+

A <logical[1]> whether to reverse continuous guides. +If TRUE, guides like colour bars are flipped. If FALSE (default), +the original order is maintained.

+ + +
oob
+

An out-of-bounds handling function that affects the cap colour. +Can be one of the following:

  • A <function> like oob_squish.

  • +
  • A <character[1]> naming such a function without the 'oob'-prefix, +such as "keep".

  • +
+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ + +
available_aes
+

A <character> vector listing the aesthetics for which this guide can +be build.

+ +
+
+

Value

+ + +

A <Guide> object

+
+
+

Details

+

As colours are always rendered as gradients, it is important to use a +graphics device that can render these. This can be checked by using +check_device("gradients").

+
+
+

See also

+

Other standalone guides: +guide_axis_custom(), +guide_coloursteps_custom(), +guide_subtitle()

+
+ +
+

Examples

+
# A standard plot
+p <- ggplot(mpg, aes(displ, hwy)) +
+  geom_point(aes(colour = cty))
+
+# The colourbar shows caps when values are out-of-bounds (oob)
+p + scale_colour_viridis_c(
+  limits = c(10, NA),
+  guide = "colourbar_custom"
+)
+
+
+# It also shows how oob values are handled
+p + scale_colour_viridis_c(
+  limits = c(10, NA), oob = scales::oob_squish,
+  guide = "colourbar_custom"
+)
+
+
+# Adjusting the type of cap
+p + scale_colour_viridis_c(
+  limits = c(10, 30), oob = scales::oob_squish,
+  guide = guide_colourbar_custom(shape = "round")
+)
+
+
+# One-sided ticks
+p + scale_colour_viridis_c(
+  guide = guide_colourbar_custom(second_guide = "none")
+)
+
+
+# Colour bar with minor breaks
+p + scale_colour_viridis_c(
+  minor_breaks = breaks_width(1),
+  guide = guide_colourbar_custom(key = "minor")
+)
+#> Error in breaks_width(1): could not find function "breaks_width"
+
+# Using log ticks on a colourbar
+ggplot(msleep, aes(sleep_total, sleep_rem)) +
+  geom_point(aes(colour = bodywt), na.rm = TRUE) +
+  scale_colour_viridis_c(
+    transform = "log10",
+    guide = guide_colourbar_custom(key = "log")
+  )
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/guide_coloursteps_custom-1.png b/reference/guide_coloursteps_custom-1.png new file mode 100644 index 0000000..ff9da90 Binary files /dev/null and b/reference/guide_coloursteps_custom-1.png differ diff --git a/reference/guide_coloursteps_custom-2.png b/reference/guide_coloursteps_custom-2.png new file mode 100644 index 0000000..ab06857 Binary files /dev/null and b/reference/guide_coloursteps_custom-2.png differ diff --git a/reference/guide_coloursteps_custom-3.png b/reference/guide_coloursteps_custom-3.png new file mode 100644 index 0000000..c6b25c0 Binary files /dev/null and b/reference/guide_coloursteps_custom-3.png differ diff --git a/reference/guide_coloursteps_custom-4.png b/reference/guide_coloursteps_custom-4.png new file mode 100644 index 0000000..6d55f5c Binary files /dev/null and b/reference/guide_coloursteps_custom-4.png differ diff --git a/reference/guide_coloursteps_custom-5.png b/reference/guide_coloursteps_custom-5.png new file mode 100644 index 0000000..a3bf95a Binary files /dev/null and b/reference/guide_coloursteps_custom-5.png differ diff --git a/reference/guide_coloursteps_custom-6.png b/reference/guide_coloursteps_custom-6.png new file mode 100644 index 0000000..652ab68 Binary files /dev/null and b/reference/guide_coloursteps_custom-6.png differ diff --git a/reference/guide_coloursteps_custom.html b/reference/guide_coloursteps_custom.html new file mode 100644 index 0000000..ea65ed8 --- /dev/null +++ b/reference/guide_coloursteps_custom.html @@ -0,0 +1,247 @@ + +Custom colour steps guide — guide_coloursteps_custom • gguidance + Skip to contents + + +
+
+
+ +
+

Similar to guide_coloursteps(), this guide +displays continuous colour or fill aesthetics. It has additional options +to display caps at the end of the bar, depending on out-of-bounds values.

+
+ +
+

Usage

+
guide_coloursteps_custom(
+  title = waiver(),
+  key = "bins",
+  first_guide = "labels",
+  second_guide = "none",
+  shape = "triangle",
+  size = NULL,
+  show = NA,
+  alpha = NA,
+  reverse = FALSE,
+  oob = scales::oob_keep,
+  theme = NULL,
+  position = waiver(),
+  available_aes = c("colour", "fill")
+)
+
+ +
+

Arguments

+
title
+

A <character[1]> or <expression[1]> indicating the title of +the guide. If NULL, the title is not shown. The default, +waiver(), takes the name of the scale object or +the name specified in labs() as the title.

+ + +
key
+

A bins key specificiation. Defaults to +key_bins(even.steps = FALSE, show.limits = NULL). Changing the +arguments to key_bins() is fine, but changing the key type is not +advised.

+ + +
first_guide, second_guide
+

Guides to flank the colour steps. Each guide +can be specified using one of the following:

  • A <Guide> class object.

  • +
  • A <function> that returns a <Guide> class object.

  • +
  • A <character> naming such a function, without the guide_ or +primitive_ prefix.

  • +

The first_guide will be placed at the location specified by the +legend.text.position theme setting. The second_guide will be placed +opposite that position. When second_guide has a label suppression +mechanism, no labels will be drawn for that guide.

+ + +
shape
+

A cap specification by providing one of the +following:

  • A cap <function>, such as cap_triangle().

  • +
  • A <character[1]> naming a cap function without the 'cap_'-prefix, +e.g. "round".

  • +
  • A two column <matrix[n, 2]> giving coordinates for a cap, like those +created by cap functions such as cap_arch().

  • +
+ + +
size
+

A <unit> setting the size of the cap. When +NULL (default), cap size will be proportional to the shape coordinates +and the legend.key.size theme setting.

+ + +
show
+

A <logical> to control how caps are displayed at the ends +of the bar. When TRUE, caps are always displayed. When FALSE, caps +are never displayed. When NA (default), caps are displayed when the +data range exceed the limits. When given as <logical[2]>, show[1] +controls the display at the lower end and show[2] at the upper end.

+ + +
alpha
+

A <numeric[1]> between 0 and 1 setting the colour transparency +of the bar. Use NA to preserve the alpha encoded in the colour itself.

+ + +
reverse
+

A <logical[1]> whether to reverse continuous guides. +If TRUE, guides like colour bars are flipped. If FALSE (default), +the original order is maintained.

+ + +
oob
+

An out-of-bounds handling function that affects the cap colour. +Can be one of the following:

  • A <function> like oob_squish.

  • +
  • A <character[1]> naming such a function without the 'oob'-prefix, +such as "keep".

  • +
+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ + +
available_aes
+

A <character> vector listing the aesthetics for which this guide can +be build.

+ +
+
+

Value

+ + +

A <Guide> object

+
+
+

Details

+

As steps are rendered as clipped rectangles, it is important to use a +graphics device that can render clipped paths. This can be checked by using +check_device("clippingPaths").

+
+
+

See also

+

Other standalone guides: +guide_axis_custom(), +guide_colourbar_custom(), +guide_subtitle()

+
+ +
+

Examples

+
p <- ggplot(mpg, aes(displ, hwy)) +
+  geom_point(aes(colour = cty))
+
+# The colour steps show caps when values are out-of-bounds
+p + scale_colour_viridis_b(
+  limits = c(10, NA),
+  guide = "coloursteps_custom"
+)
+
+
+# It also shows how oob values are handled
+p + scale_colour_viridis_b(
+  limits = c(10, 30), oob = scales::oob_censor,
+  guide = "coloursteps_custom"
+)
+
+
+# Adjusting the type of cap
+p + scale_colour_viridis_b(
+  limits = c(10, 30),
+  guide = guide_coloursteps_custom(shape = "round")
+)
+
+
+# The default is to use the breaks as-is
+p + scale_colour_viridis_b(
+  limits = c(10, 30), breaks = c(10, 20, 25),
+  guide = "coloursteps_custom"
+)
+
+
+# But the display can be set to use evenly spaced steps
+p + scale_colour_viridis_b(
+  limits = c(10, 30), breaks = c(10, 20, 25),
+  guide = guide_coloursteps_custom(key = key_bins(even.steps = TRUE))
+)
+
+
+# Using tick marks by swapping side guides
+p + scale_colour_viridis_b(
+  guide = guide_coloursteps_custom(
+    first_guide  = "axis_custom",
+    second_guide = "axis_custom"
+  )
+)
+
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/guide_subtitle-1.png b/reference/guide_subtitle-1.png new file mode 100644 index 0000000..c479845 Binary files /dev/null and b/reference/guide_subtitle-1.png differ diff --git a/reference/guide_subtitle-2.png b/reference/guide_subtitle-2.png new file mode 100644 index 0000000..318d45e Binary files /dev/null and b/reference/guide_subtitle-2.png differ diff --git a/reference/guide_subtitle-3.png b/reference/guide_subtitle-3.png new file mode 100644 index 0000000..c479845 Binary files /dev/null and b/reference/guide_subtitle-3.png differ diff --git a/reference/guide_subtitle.html b/reference/guide_subtitle.html new file mode 100644 index 0000000..39ba951 --- /dev/null +++ b/reference/guide_subtitle.html @@ -0,0 +1,184 @@ + +Subtitle with coloured phrases — guide_subtitle • gguidance + Skip to contents + + +
+
+
+ +
+

This guides formats a piece of text with colours determined from the scale.

+
+ +
+

Usage

+
guide_subtitle(title = waiver(), open = "{.", close = "}", theme = NULL)
+
+ +
+

Arguments

+
title
+

A <character[1]> containing text to use as subtitle. Text +formatting is discussed in details.

+ + +
open, close
+

A <character[1]> delimiter indicating where colour +formatting begins (open) and ends (close).

+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ +
+
+

Value

+ + +

A <Guide> object.

+
+
+

Details

+ +
+

Text formatting

+ + +

Chunks of text are formatted as follows: the title is chopped up into +pieces split by the open and close delimiters. When the open delimiter +is followed by an integer, that integer is matched up against the scale's +breaks. The piece of text between that open delimiter and the associated +close delimiter is that coloured with the break's colour.

+

For example, in the title +"A {.1 quick} brown {.3 fox} jumps over the {.2 lazy dog}.", the word +"quick" is given the scale's first colour, "fox" is given the third +colour and "lazy dog" is given the second colour. The first space after +the integer index gets trimmed.

+

When there is no text inside the braces other than the index, the scale's +labels are inserted as text.

+

While implemented as a legend guide, it takes style options from the +plot.subtitle theme element. As it is not a true subtitle, there might +be complications if other guides co-occupy the "top" legend position.

+
+ +
+

Right-to-left scripts

+ + +

The typesetting of this guide is primitive and only concerns itself with +placing text pieces, not individual glyphs. The only consideration given +to right-to-left script is that a line is converted from LtR to RtL when +all pieces of text on a line contain characters from RtL character sets. +Bidirectional text is given no consideration within this function. Glyphs +that should have ligatures in normal text, but are in separate pieces will +probably not render as ligatures. The task of actually rendering what is +within pieces of text, is handled by the graphics device, which have varying +degrees of modern text feature support. The author of this function, +who only knows LtR natural languages, profusely apologises for this +inconvenience.

+
+ +
+
+

See also

+ +
+ +
+

Examples

+
# A standard plot
+p <- ggplot(mpg, aes(displ, hwy, colour = factor(cyl))) +
+  geom_point()
+
+# Typical use case
+p + scale_colour_discrete(
+  name = "Cars with {.1 four}, {.2 five}, {.3 six} or {.4 eight} cylinders.",
+  guide = "subtitle"
+)
+
+
+# If there is no text in between the delimiters, the scale's `labels` are
+# substituted.
+p + scale_colour_discrete(
+  labels = c("FOUR", "5", "Six", "foobar"),
+  name   = "Cars with {.1}, {.2}, {.3} or {.4} cylinders.",
+  guide  = "subtitle"
+)
+
+
+# Using different text delimiters
+p + guides(colour = guide_subtitle(
+  "Cars with <1 four>, <2 five>, <3 six> or <4 eight> cylinders.",
+  open = "<", close = ">"
+))
+
+
+# # For use with {ggtext}, mix html with the open and closing delimiters.
+# # Leave out the '\' before quotation marks, it didn't document without
+# # these backslashes :(
+# p +
+#   scale_colour_discrete(
+#     name  = \"Cars with {.1}, <b>{.2 five}</b>, {.3} or {.4} <i>cylinders</i>.\",
+#     guide = "subtitle"
+#   ) +
+#   theme(plot.subtitle = ggtext::element_markdown())
+
+
+
+ + +
+ + + +
+ + + + + + + diff --git a/reference/index.html b/reference/index.html index 9383726..dffc83e 100644 --- a/reference/index.html +++ b/reference/index.html @@ -1,5 +1,5 @@ -Function reference • gguidanceFunction reference • gguidance @@ -10,7 +10,7 @@ gguidance - 0.0.0.9000 + 0.0.0.9001
+ + + + + +
+
+
+ +
+

These functions are helper functions for working with ranged data as keys +in guides. They all share the goal creating of a guide key, but have +different methods:

  • key_range_auto() is a function factory whose functions make an attempt +to infer ranges from the scale's labels.

  • +
  • key_range_manual() uses user-provided vectors to set ranges.

  • +
  • key_range_map() makes mappings from a <data.frame> to set ranges.

  • +
+ +
+

Usage

+
key_range_auto(sep = "[^[:alnum:]]+", reverse = FALSE)
+
+key_range_manual(start, end, name = NULL, level = NULL)
+
+key_range_map(data, ..., .call = caller_env())
+
+ +
+

Arguments

+
sep
+

A <character[1]> giving a regular expression to +use for splitting labels provided by the scale using +strsplit(). Defaults to splitting on any +non-alphanumeric character.

+ + +
reverse
+

A <logical[1]> which if FALSE (default) treats the first +labels as the inner labels and the last labels as the outer labels. +If TRUE, thee first labels are treated as the outer labels and the last +labels are treated as the inner labels.

+ + +
start, end
+

A vector that can be interpreted by the scale, giving the +start and end positions of each range respectively.

+ + +
name
+

A <character> or list of expressions

+ + +
level
+

An <integer> giving the depth of each range to avoid overlaps +between different ranges. When level is smaller than 1, no brackets are +drawn.

+ + +
data
+

A <data.frame> or similar object coerced by +fortify() to a <data.frame>, in which the mapping +argument is evaluated.

+ + +
...
+

<data-masking> A set of mappings +similar to those provided to aes(), which will be +evaluated in the data argument. These must contain start and end +mappings.

+ + +
.call
+

A call to display in messages.

+ +
+
+

Value

+ + +

For key_range_auto() a function. For key_range_manual() and +key_range_map() a <data.frame> with the <key_range> class.

+
+
+

Details

+

The level variable is optional and when missing, the guides use an +algorithm similar to IRanges::disjointBins() to avoid overlaps.

+

The key_range_auto() does not work with expression labels.

+
+
+

See also

+ +
+ +
+

Examples

+
# Example scale
+template <- scale_x_discrete(limits = c("A 1", "B 1", "C&1", "D&2", "E&2"))
+
+# By default, splits on all non-alphanumeric characters
+auto <- key_range_auto()
+auto(template)
+#>   start end .label .level
+#> 1     1   1      A      0
+#> 2     2   2      B      0
+#> 3     3   3      C      0
+#> 4     4   4      D      0
+#> 5     5   5      E      0
+#> 6     1   3      1      1
+#> 7     4   5      2      1
+
+# Only split on a specific character
+auto <- key_range_auto(sep = "&")
+auto(template)
+#> Warning: Not all labels in `key_range_auto()` can be split into equal lengths.
+#>  Is "&" the correct `sep` argument?
+#>   start end .label .level
+#> 1     1   1    A 1      0
+#> 2     2   2    B 1      0
+#> 3     3   3      C      0
+#> 4     4   4      D      0
+#> 5     5   5      E      0
+#> 6     3   3      1      1
+#> 7     4   5      2      1
+
+# Treating the letters as outer labels and numbers as inner labels
+auto <- key_range_auto(reverse = TRUE)
+auto(template)
+#>    start end .label .level
+#> 1      1   1      1      0
+#> 2      2   2      1      0
+#> 3      3   3      1      0
+#> 4      4   4      2      0
+#> 5      5   5      2      0
+#> 6      1   1      A      1
+#> 7      2   2      B      1
+#> 8      3   3      C      1
+#> 9      4   4      D      1
+#> 10     5   5      E      1
+
+# Providing custom values
+key_range_manual(
+  start = c(1, 5,  10),
+  end   = c(4, 15, 11),
+  level = c(0, 2, 1),
+  name  = c("A", "B", "C")
+)
+#>   start end .label .level
+#> 1     1   4      A      0
+#> 2     5  15      B      2
+#> 3    10  11      C      1
+
+# Values from a <data.frame>
+key_range_map(presidential, start = start, end = end, name = name)
+#>         start        end     .label
+#> 1  1953-01-20 1961-01-20 Eisenhower
+#> 2  1961-01-20 1963-11-22    Kennedy
+#> 3  1963-11-22 1969-01-20    Johnson
+#> 4  1969-01-20 1974-08-09      Nixon
+#> 5  1974-08-09 1977-01-20       Ford
+#> 6  1977-01-20 1981-01-20     Carter
+#> 7  1981-01-20 1989-01-20     Reagan
+#> 8  1989-01-20 1993-01-20       Bush
+#> 9  1993-01-20 2001-01-20    Clinton
+#> 10 2001-01-20 2009-01-20       Bush
+#> 11 2009-01-20 2017-01-20      Obama
+#> 12 2017-01-20 2021-01-20      Trump
+
+
+
+ + +
+ + + + + + + diff --git a/reference/key_specialty.html b/reference/key_specialty.html new file mode 100644 index 0000000..eaace48 --- /dev/null +++ b/reference/key_specialty.html @@ -0,0 +1,166 @@ + +Speciality keys — key_specialty • gguidance + Skip to contents + + +
+
+
+ +
+

These functions are helper functions for working with keys in guides. The +functions described here are not widely applicable and may only apply +to a small subset of guides. As such, it is fine to adjust the arguments +of a speciality key, but swapping types is ill-advised.

  • key_sequence() is a function factory whose functions create a regularly +spaced sequence between the limits of a scale. It is used in colour bar +guides.

  • +
  • key_bins() is a function factory whose function create a binned key +given the breaks in the scale. It is used in colour steps guides.

  • +
+ +
+

Usage

+
key_sequence(n = 15)
+
+key_bins(even.steps = FALSE, show.limits = NULL)
+
+ +
+

Arguments

+
n
+

A positive <integer[1]> giving the number of colours to use for a +gradient.

+ + +
even.steps
+

A <logical[1]> indicating whether the size of bins +should be displayed as equal (TRUE) or proportional to their length in +data space (FALSE).

+ + +
show.limits
+

A <logical[1]> stating whether the limits of the scale +should be shown with labels and ticks (TRUE) or remain hidden (FALSE). +Note that breaks coinciding with limits are shown regardless of this +setting. The default, NULL, consults the scale's show.limits setting +or defaults to FALSE.

+ +
+
+

Value

+ + +

For key_sequence() a function.

+
+
+

See also

+

Other keys: +key_range, +key_standard

+
+ +
+

Examples

+
# An example scale
+template <- scale_fill_viridis_c(limits = c(0, 10), breaks = c(2, 4, 6, 8))
+
+# Retrieving colourbar and colourstep keys
+key_sequence()(template)
+#>       fill     .value
+#> 1  #440154  0.0000000
+#> 2  #461F66  0.7142857
+#> 3  #453478  1.4285714
+#> 4  #414888  2.1428571
+#> 5  #3C5B8A  2.8571429
+#> 6  #336D8D  3.5714286
+#> 7  #2B7F8D  4.2857143
+#> 8  #2B9089  5.0000000
+#> 9  #26A186  5.7142857
+#> 10 #40B17B  6.4285714
+#> 11 #5FBF69  7.1428571
+#> 12 #76CE56  7.8571429
+#> 13 #A4D848  8.5714286
+#> 14 #D2E039  9.2857143
+#> 15 #FDE725 10.0000000
+key_bins()(template)
+#>      fill min max .label .value
+#> 1 #46286D   0   2   <NA>     NA
+#> 2 #3B5E8B   2   4      2      2
+#> 3 #2B9089   4   6      4      4
+#> 4 #5ABC6D   6   8      6      6
+#> 5 #C0DD40   8  10      8      8
+#> 6    <NA>  NA  NA   <NA>     NA
+
+
+
+ + +
+ + + + + + + diff --git a/reference/key_standard.html b/reference/key_standard.html new file mode 100644 index 0000000..04a6bf6 --- /dev/null +++ b/reference/key_standard.html @@ -0,0 +1,252 @@ + +Standard keys — key_standard • gguidance + Skip to contents + + +
+
+
+ +
+

These functions are helper functions for working with tick marks as keys +in guides. They all share the goal of creating a guide key, but have +different outcomes:

  • key_auto() is a function factory whose functions extract a typical +key from major breaks in a scale.

  • +
  • key_manual() uses user-provided vectors to make a key.

  • +
  • key_map() makes mappings from a <data.frame> to make a key.

  • +
  • key_minor() is a function factory whose functions also extract minor +break positions for minor tick marks.

  • +
  • key_log() is a function factory whose functions place ticks at intervals +in log10 space.

  • +
+ +
+

Usage

+
key_auto()
+
+key_manual(
+  aesthetic,
+  value = aesthetic,
+  label = as.character(value),
+  type = NULL
+)
+
+key_map(data, ..., .call = caller_env())
+
+key_minor()
+
+key_log(
+  prescale_base = NULL,
+  negative_small = 0.1,
+  expanded = TRUE,
+  labeller = label_log()
+)
+
+ +
+

Arguments

+
aesthetic, value
+

A vector of values for the guide to represent +equivalent to the breaks argument in scales. The aesthetic will be +mapped, whereas value will not. For most intents and purposes, +aesthetic and value should be identical.

+ + +
label
+

A <character> or list of expressions to use as labels.

+ + +
type
+

A <character> vector representing the one of the break types: +"major", "minor" or "mini". If NULL (default), all breaks are +treated as major breaks.

+ + +
data
+

A <data.frame> or similar object coerced by +fortify() to a <data.frame>, in which the mapping +argument is evaluated.

+ + +
...
+

<data-masking> A set of mappings +similar to those provided to aes(), which will be +evaluated in the data argument. These must contain aesthetic mapping.

+ + +
.call
+

A call to display in messages.

+ + +
expanded
+

Whether the ticks should cover the range after scale +expansion (TRUE, default), or be restricted to the scale limits +(FALSE).

+ + +
labeller
+

A <function> that receives major breaks and returns +formatted labels.

+ +
+
+

Value

+ + +

For key_auto(), key_minor() and key_log() a function. For +key_manual() and key_map() a <data.frame> with the <key_standard>

+ + +

class.

+
+
+

See also

+

Other keys: +key_range, +key_specialty

+
+ +
+

Examples

+
# An example scale
+template <- scale_x_continuous(limits = c(0, 10))
+
+# The auto, minor and log keys operate on scales
+key_auto()(template)
+#>      x .value .label
+#> 1  0.0    0.0    0.0
+#> 2  2.5    2.5    2.5
+#> 3  5.0    5.0    5.0
+#> 4  7.5    7.5    7.5
+#> 5 10.0   10.0   10.0
+key_minor()(template)
+#>       x .value .label .type
+#> 1  0.00   0.00    0.0 major
+#> 2  2.50   2.50    2.5 major
+#> 3  5.00   5.00    5.0 major
+#> 4  7.50   7.50    7.5 major
+#> 5 10.00  10.00   10.0 major
+#> 6  1.25   1.25   <NA> minor
+#> 7  3.75   3.75   <NA> minor
+#> 8  6.25   6.25   <NA> minor
+#> 9  8.75   8.75   <NA> minor
+
+# So does the log key
+template <- scale_x_continuous(transform = "log10", limits = c(0.1, 10))
+key_log()(template)
+#>              x      .value .label .type
+#> 1  -1.00000000 -1.00000000  10^-1 major
+#> 2   0.00000000  0.00000000   10^0 major
+#> 3   1.00000000  1.00000000   10^1 major
+#> 4  -0.30103000 -0.30103000   NULL minor
+#> 5   0.69897000  0.69897000   NULL minor
+#> 6  -0.69897000 -0.69897000   NULL  mini
+#> 7  -0.52287875 -0.52287875   NULL  mini
+#> 8  -0.39794001 -0.39794001   NULL  mini
+#> 9  -0.22184875 -0.22184875   NULL  mini
+#> 10 -0.15490196 -0.15490196   NULL  mini
+#> 11 -0.09691001 -0.09691001   NULL  mini
+#> 12 -0.04575749 -0.04575749   NULL  mini
+#> 13  0.30103000  0.30103000   NULL  mini
+#> 14  0.47712125  0.47712125   NULL  mini
+#> 15  0.60205999  0.60205999   NULL  mini
+#> 16  0.77815125  0.77815125   NULL  mini
+#> 17  0.84509804  0.84509804   NULL  mini
+#> 18  0.90308999  0.90308999   NULL  mini
+#> 19  0.95424251  0.95424251   NULL  mini
+
+# Providing custom values
+key_manual(
+  aesthetic = 1:5,
+  label = c("one", "two", "three", "four", "five")
+)
+#>   aesthetic .value .label
+#> 1         1      1    one
+#> 2         2      2    two
+#> 3         3      3  three
+#> 4         4      4   four
+#> 5         5      5   five
+
+# Values from a `<data.frame>`
+key_map(ToothGrowth, aesthetic = unique(supp))
+#>   aesthetic .value .label
+#> 1        VC     VC     VC
+#> 2        OJ     OJ     OJ
+
+
+
+ + +
+ + + + + + + diff --git a/reference/primitive_box-1.png b/reference/primitive_box-1.png new file mode 100644 index 0000000..e8f4153 Binary files /dev/null and b/reference/primitive_box-1.png differ diff --git a/reference/primitive_box.html b/reference/primitive_box.html new file mode 100644 index 0000000..ebde451 --- /dev/null +++ b/reference/primitive_box.html @@ -0,0 +1,184 @@ + +Guide primitives: boxes — primitive_box • gguidance + Skip to contents + + +
+
+
+ +
+

This function constructs a boxes guide primitive.

+
+ +
+

Usage

+
primitive_box(
+  key = "range_auto",
+  angle = waiver(),
+  oob = "squish",
+  drop_zero = TRUE,
+  pad_discrete = 0.4,
+  min_size = NULL,
+  theme = NULL,
+  position = waiver()
+)
+
+ +
+

Arguments

+
key
+

A range key specification. See more information +in the linked topic.

+ + +
angle
+

A specification for the text angle. Compared to setting the angle argument +in element_text(), this argument uses some +heuristics to automatically pick the hjust and vjust that you +probably want. Can be one of the following:

  • NULL to take angles and justification settings directly from the theme.

  • +
  • waiver() to allow reasonable defaults in special +cases.

  • +
  • A <numeric[1]> between -360 and 360 for the text angle in degrees.

  • +
+ + +
oob
+

A method for dealing with out-of-bounds (oob) ranges. Can be one +of "squish", "censor" or "none".

+ + +
drop_zero
+

A <logical[1]> whether to drop near-zero width ranges +(TRUE, default) or preserve them (FALSE).

+ + +
pad_discrete
+

A <numeric[1]> giving the amount ranges should be +extended when given as a discrete variable. This is applied after +the drop_zero setting.

+ + +
min_size
+
+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ +
+
+

Value

+ + +

A <PrimitiveBox> primitive guide that can be used inside other +guides.

+
+
+

Styling options

+

Below are the theme options that determine the styling of +this guide, which may differ depending on whether the guide is used in +an axis or in a legend context.

+

Common to both types is the following:

  • gguidance.box an <element_rect> for the boxes +to draw.

  • +
+

As an axis guide

+ +
  • axis.text.{x/y}.{position} an <element_text> +for the text inside the boxes.

  • +
+ +
+

As a legend guide

+ +
  • legend.text an <element_text> for the text +inside the boxes.

  • +
+ +
+
+

See also

+ +
+ +
+

Examples

+
# A standard plot
+p <- ggplot(mpg, aes(interaction(drv, year), displ)) +
+ geom_point()
+
+key <- key_range_manual(c(2, 4), c(5, 6), c("A", "B"))
+
+# Adding as secondary guides
+p + guides(
+  x.sec = primitive_box(),
+  y.sec = primitive_box(key = key)
+)
+
+
+
+
+ + +
+ + + + + + + diff --git a/reference/primitive_bracket-1.png b/reference/primitive_bracket-1.png new file mode 100644 index 0000000..925b88a Binary files /dev/null and b/reference/primitive_bracket-1.png differ diff --git a/reference/primitive_bracket.html b/reference/primitive_bracket.html new file mode 100644 index 0000000..533fafb --- /dev/null +++ b/reference/primitive_bracket.html @@ -0,0 +1,192 @@ + +Guide primitive: brackets — primitive_bracket • gguidance + Skip to contents + + +
+
+
+ +
+

This function constructs a brackets guide primitive.

+
+ +
+

Usage

+
primitive_bracket(
+  key = "range_auto",
+  bracket = "line",
+  angle = waiver(),
+  oob = "squish",
+  drop_zero = TRUE,
+  pad_discrete = 0.4,
+  theme = NULL,
+  position = waiver()
+)
+
+ +
+

Arguments

+
key
+

A range key specification. See more information +in the linked topic.

+ + +
bracket
+

A bracket by providing one of the +following:

  • A bracket <function>, such as bracket_square.

  • +
  • A <character[1]> naming a bracket function without the +'bracket_'-prefix, e.g. "square".

  • +
  • A two-column <matrix[n, 2]> giving line coordinates for a bracket, +like those created by bracket functions, such as bracket_round().

  • +
+ + +
angle
+

A specification for the text angle. Compared to setting the angle argument +in element_text(), this argument uses some +heuristics to automatically pick the hjust and vjust that you +probably want. Can be one of the following:

  • NULL to take angles and justification settings directly from the theme.

  • +
  • waiver() to allow reasonable defaults in special +cases.

  • +
  • A <numeric[1]> between -360 and 360 for the text angle in degrees.

  • +
+ + +
oob
+

A method for dealing with out-of-bounds (oob) ranges. Can be one +of "squish", "censor" or "none".

+ + +
drop_zero
+

A <logical[1]> whether to drop near-zero width ranges +(TRUE, default) or preserve them (FALSE).

+ + +
pad_discrete
+

A <numeric[1]> giving the amount ranges should be +extended when given as a discrete variable. This is applied after +the drop_zero setting.

+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ +
+
+

Value

+ + +

A <PrimitiveBracket> primitive guide that can be used inside other +guides.

+
+
+

Styling options

+

Below are the theme options that determine the styling of +this guide, which may differ depending on whether the guide is used in an +axis or a legend context.

+

Common to both types is the following:

  • gguidance.bracket an <element_line> for the +line used to draw the brackets.

  • +
  • gguidance.backet.size a <unit> setting the space afforded +to a bracket.

  • +
+

As an axis guide

+ +
  • axis.text.{x/y}.{position} an <element_text> +for the text displayed over the brackets.

  • +
+ +
+

As a legend guide

+ +
  • legend.text an <element_text> for the text +displayed over the brackets.

  • +
+ +
+
+

See also

+ +
+ +
+

Examples

+
# A standard plot
+p <- ggplot(mpg, aes(interaction(drv, year), displ)) +
+ geom_point()
+
+key <- key_range_manual(c(2, 4), c(5, 6), c("A", "B"))
+
+# Adding as secondary guides
+p + guides(
+  x.sec = primitive_bracket(),
+  y.sec = primitive_bracket(key = key)
+)
+
+
+
+
+ + +
+ + + + + + + diff --git a/reference/primitive_labels-1.png b/reference/primitive_labels-1.png new file mode 100644 index 0000000..5a8d35e Binary files /dev/null and b/reference/primitive_labels-1.png differ diff --git a/reference/primitive_labels.html b/reference/primitive_labels.html new file mode 100644 index 0000000..db199a3 --- /dev/null +++ b/reference/primitive_labels.html @@ -0,0 +1,168 @@ + +Guide primitive: labels — primitive_labels • gguidance + Skip to contents + + +
+
+
+ +
+

This function constructs a labels guide primitive.

+
+ +
+

Usage

+
primitive_labels(
+  key = NULL,
+  angle = waiver(),
+  n.dodge = 1,
+  check.overlap = FALSE,
+  theme = NULL,
+  position = waiver()
+)
+
+ +
+

Arguments

+
key
+

A standard key specification. See more information +in the linked topic.

+ + +
angle
+

A specification for the text angle. Compared to setting the angle argument +in element_text(), this argument uses some +heuristics to automatically pick the hjust and vjust that you +probably want. Can be one of the following:

  • NULL to take angles and justification settings directly from the theme.

  • +
  • waiver() to allow reasonable defaults in special +cases.

  • +
  • A <numeric[1]> between -360 and 360 for the text angle in degrees.

  • +
+ + +
n.dodge
+

An positive <integer[1]> setting the number of layers text +labels can occupy to avoid overlapping labels.

+ + +
check.overlap
+

A <logical[1]> indicating whether to check for and +omit overlapping text. If TRUE, first, last and middle labels are +recursively prioritised in that order. If FALSE, all labels are drawn.

+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ +
+
+

Value

+ + +

A <PrimitiveLabels> primitive guide that can be used inside other +guides.

+
+
+

Styling options

+

Below are the theme options that determine the styling of +this guide, which may differ depending on whether the guide is used in +an axis or in a legend context.

+

As an axis guide

+ +
  • axis.text.{x/y}.{position} an <element_text> +for the display of the labels.

  • +
+ +
+

As a legend guide.

+ +
  • legend.text an <element_text> for the display +of the labels.

  • +
+ +
+
+

See also

+ +
+ +
+

Examples

+
# A standard plot
+p <- ggplot(mpg, aes(displ, hwy)) +
+ geom_point()
+
+# Adding as secondary guides
+p + guides(
+  x.sec = primitive_labels(),
+  y.sec = primitive_labels(n.dodge = 2)
+)
+
+
+
+
+ + +
+ + + + + + + diff --git a/reference/primitive_line-1.png b/reference/primitive_line-1.png new file mode 100644 index 0000000..d4cf9d5 Binary files /dev/null and b/reference/primitive_line-1.png differ diff --git a/reference/primitive_line.html b/reference/primitive_line.html new file mode 100644 index 0000000..ebcedb5 --- /dev/null +++ b/reference/primitive_line.html @@ -0,0 +1,156 @@ + +Guide primitive: line — primitive_line • gguidance + Skip to contents + + +
+
+
+ +
+

This function constructs a line guide primitive.

+
+ +
+

Usage

+
primitive_line(key = NULL, cap = "none", theme = NULL, position = waiver())
+
+ +
+

Arguments

+
key
+

A standard key specification. See more information +in the linked topic.

+ + +
cap
+

A method to cap the axes. One of the following:

  • A <character[1]> with one of the following:

    • "none" to perform no capping.

    • +
    • "both" to cap the line at both ends at the most extreme breaks.

    • +
    • "upper" to cap the line at the upper extreme break.

    • +
    • "lower" to cap the line at the lower extreme break.

    • +
  • +
  • A <logical>[1], where TRUE is equivalent to "both" and FALSE +is equivalent to "none" in the options above.

  • +
  • A sorted <numeric>[2n] with an even number of members. The lines +will be drawn between every odd-even pair.

  • +
  • A <function> that takes the scale's breaks as the first argument, the +scale's limits as the second argument and returns a <numeric>[2n] as +described above.

  • +
+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ +
+
+

Value

+ + +

A PrimitiveLine primitive guide that can be used inside other +guides.

+
+
+

Styling options

+

Below are the theme options that determine the styling of +this guide, which may differ depending on whether the guide is used in +an axis or in a legend context.

+

As an axis guide

+ +
  • axis.line.{x/y}.{position} an <element_line> +for the line style.

  • +
+ +
+

As a legend guide

+ +
  • legend.axis.line an <element_line> for the +line style.

  • +
+ +
+
+

See also

+ +
+ +
+

Examples

+
# A standard plot
+p <- ggplot(mpg, aes(displ, hwy)) +
+  geom_point() +
+  theme(axis.line = element_line())
+
+# Adding as secondary guides
+p + guides(
+  x.sec = primitive_line(),
+  y.sec = primitive_line(cap = "both")
+)
+
+
+
+
+ + +
+ + + + + + + diff --git a/reference/primitive_spacer-1.png b/reference/primitive_spacer-1.png new file mode 100644 index 0000000..b5503a5 Binary files /dev/null and b/reference/primitive_spacer-1.png differ diff --git a/reference/primitive_spacer.html b/reference/primitive_spacer.html new file mode 100644 index 0000000..05f6d3f --- /dev/null +++ b/reference/primitive_spacer.html @@ -0,0 +1,134 @@ + +Guide primitive: spacer — primitive_spacer • gguidance + Skip to contents + + +
+
+
+ +
+

This function constructs a spacer guide primitive.

+
+ +
+

Usage

+
primitive_spacer(
+  space = NULL,
+  title = waiver(),
+  theme = NULL,
+  position = waiver()
+)
+
+ +
+

Arguments

+
space
+

A [<unit[1]>][grid::unit()]

+ + +
title
+

A <character[1]> or <expression[1]> indicating the title of +the guide. If NULL, the title is not shown. The default, +waiver(), takes the name of the scale object or +the name specified in labs() as the title.

+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ +
+
+

Value

+ + +

A <PrimitiveSpacer> primitive guide that can be used inside +other guides.

+
+
+

Styling options

+

#' Below are the theme options that determine the styling of +this guide. This guide does not have option dependent on its role as axis or +legend.

  • gguidance.guide.spacing A <unit> setting the amount of +spacing when the space argument is NULL.

  • +
+
+

See also

+ +
+ +
+

Examples

+
ggplot(mpg, aes(displ, hwy)) +
+  geom_point() +
+  guides(
+    x = guide_axis_stack("axis", primitive_spacer(unit(1, "cm")), "axis")
+  )
+
+
+
+
+ + +
+ + + + + + + diff --git a/reference/primitive_ticks-1.png b/reference/primitive_ticks-1.png new file mode 100644 index 0000000..d17f88a Binary files /dev/null and b/reference/primitive_ticks-1.png differ diff --git a/reference/primitive_ticks.html b/reference/primitive_ticks.html new file mode 100644 index 0000000..83e1fe1 --- /dev/null +++ b/reference/primitive_ticks.html @@ -0,0 +1,163 @@ + +Guide primitive: line — primitive_ticks • gguidance + Skip to contents + + +
+
+
+ +
+

This function constructs a ticks guide primitive.

+
+ +
+

Usage

+
primitive_ticks(key = NULL, bidi = FALSE, theme = NULL, position = waiver())
+
+ +
+

Arguments

+
key
+

A standard key specification. See more information +in the linked topic.

+ + +
bidi
+

A <logical[1]>: whether ticks should be drawn bidirectionally +(TRUE) or in a single direction (FALSE, default).

+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ +
+
+

Value

+ + +

A PrimitiveTicks primitive guide that can be used inside other +guides.

+
+
+

Styling options

+

Below are the theme options that determine the styling of +this guide, which may differ depending on whether the guide is used in +an axis or in a legend context.

+

Common to both types is the following:

+

As an axis guide

+ +
  • axis.ticks.{x/y}.{position} an <element_line> +for major tick lines.

  • +
  • axis.minor.ticks.{x/y}.{position} an +<element_line> for minor tick lines.

  • +
  • gguidance.axis.mini.ticks an <element_line> +internally inheriting from the minor ticks for the smallest ticks in e.g. +log axes.

  • +
  • axis.ticks.length.{x/y}.{position} a <unit> for the major +ticks length.

  • +
  • axis.minor.ticks.length.{x/y}.{position} a <unit> for the +minor ticks length.

  • +
  • gguidance.axis.mini.ticks.length a <unit> internally +inheriting from the minor tick length for the smallest ticks in e.g. +log axes.

  • +
+ +
+

As a legend guide

+ +
  • legend.ticks an <element_line> for major tick +lines.

  • +
  • gguidance.legend.minor.ticks an <element_line> +for minor tick lines.

  • +
  • gguidance.legend.mini.ticks an <element_line> +for the smallest ticks in e.g. log axes.

  • +
  • legend.ticks.length a <unit> for the major ticks length.

  • +
  • gguidance.legend.minor.ticks.length a <unit> for the +minor ticks length.

  • +
  • gguidance.legend.mini.ticks.length a <unit> for the +smallest ticks in e.g. log axes.

  • +
+ +
+
+

See also

+ +
+ +
+

Examples

+
# A standard plot
+p <- ggplot(mpg, aes(displ, hwy)) +
+  geom_point()
+
+# Adding as secondary guides
+p + guides(x.sec = primitive_ticks(), y.sec = primitive_ticks())
+
+
+
+
+ + +
+ + + + + + + diff --git a/reference/primitive_title-1.png b/reference/primitive_title-1.png new file mode 100644 index 0000000..7e37d81 Binary files /dev/null and b/reference/primitive_title-1.png differ diff --git a/reference/primitive_title.html b/reference/primitive_title.html new file mode 100644 index 0000000..578b887 --- /dev/null +++ b/reference/primitive_title.html @@ -0,0 +1,157 @@ + +Guide primitive: title — primitive_title • gguidance + Skip to contents + + +
+
+
+ +
+

This function constructs a title guide primitive.

+
+ +
+

Usage

+
primitive_title(
+  title = waiver(),
+  angle = waiver(),
+  theme = NULL,
+  position = waiver()
+)
+
+ +
+

Arguments

+
title
+

A <character[1]> or <expression[1]> indicating the title of +the guide. If NULL, the title is not shown. The default, +waiver(), takes the name of the scale object or +the name specified in labs() as the title.

+ + +
angle
+

A specification for the text angle. Compared to setting the angle argument +in element_text(), this argument uses some +heuristics to automatically pick the hjust and vjust that you +probably want. Can be one of the following:

  • NULL to take angles and justification settings directly from the theme.

  • +
  • waiver() to allow reasonable defaults in special +cases.

  • +
  • A <numeric[1]> between -360 and 360 for the text angle in degrees.

  • +
+ + +
theme
+

A <theme> object to style the guide individually or +differently from the plot's theme settings. The theme argument in the +guide overrides and is combined with the plot's theme.

+ + +
position
+

A <character[1]> giving the location of the guide. Can be one of "top", +"bottom", "left" or "right".

+ +
+
+

Value

+ + +

A <PrimitiveTitle> primitive guide that can be used inside other +guides.

+
+
+

Styling options

+

Below are the theme options that determine the styling of +this guide, which may differ depending on whether the guide is used in +an axis or in a legend context.

+

As an axis guide

+ +
  • axis.title.{x/y}.{position} an <element_text> +for the title display.

  • +
+ +
+

As a legend guide

+ +
  • legend.title an <element_text> +for the title display.

  • +
+ +
+
+

See also

+ +
+ +
+

Examples

+
# A standard plot
+p <- ggplot(mpg, aes(displ, hwy)) +
+ geom_point()
+
+# Adding as secondary guides
+p + guides(
+  x.sec = primitive_title("Horizontal Title"),
+  y.sec = primitive_title(c("along vertical", "Multiple tiles"))
+)
+
+
+
+
+ + +
+ + + + + + + diff --git a/search.json b/search.json index 27f0544..c78e903 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://teunbrand.github.io/gguidance/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2022 Teun van den Brand Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://teunbrand.github.io/gguidance/articles/axes.html","id":"a-primer-on-position-guides","dir":"Articles","previous_headings":"","what":"A primer on position guides","title":"Axes","text":"axis guide can specified two places: scale, guides() function. can use string naming type guide omitting \"guide_\" prefix function, .e. \"axis\". want customise axis, can use function . example code setting axis scale. don’t need set scale parameters, shorter use guides() function. Setting secondary axes works much way. sec_axis() dup_axis() function guide argument can used. use guides() function, can set x.sec y.sec guides. axis extensions {gguidance} specified identically vanilla {ggplot2}. naming pattern functions generally guide_axis_{type}(). Therefore, use axes string, can use \"axis_{type}\".","code":"example + scale_x_continuous(guide = \"axis\") + scale_y_continuous(guide = guide_axis(angle = 45)) example + guides(x = \"axis\", y = guide_axis(angle = 45)) example + scale_x_continuous(sec.axis = dup_axis(guide = guide_axis(angle = 45))) + guides(y.sec = \"axis\")"},{"path":"https://teunbrand.github.io/gguidance/articles/axes.html","id":"nested-axes","dir":"Articles","previous_headings":"","what":"Nested axes","title":"Axes","text":"guide_axis_nested() function constructs axis guides can indicate ranges values. two ways use : (1) ranges can inferred labels (2) can manually set ranges interest.","code":""},{"path":"https://teunbrand.github.io/gguidance/articles/axes.html","id":"ranges-from-labels","dir":"Articles","previous_headings":"Nested axes","what":"Ranges from labels","title":"Axes","text":"default behaviour guide_axis_nested() infer ranges axis labels. inferred trying split labels based separator. interaction() function convenient , sorts levels outer variable automatically inserts \".\" separator, works well behaviour guide_axis_nested(). However, beware default separator non-alphanumeric series characters. can give problems labels already contain character. example , interaction() inserting \".\" separator, also decimal notation dose variable contains \".\". way solve issue change interaction() separator decimal notation, instruct axis use separator.","code":"ggplot(mpg, aes(y = displ, x = interaction(year, drv))) + geom_jitter(width = 0.2) + labs( x = \"Year / Drive Train\", y = \"Engine Displacement\" ) + guides(x = \"axis_nested\") ggplot(ToothGrowth, aes(interaction(dose, supp), y = len)) + geom_jitter(width = 0.2) + labs( y = \"Tooth Length\", x = \"Dose / Supplement type\" ) + guides(x = \"axis_nested\") #> Warning: Not all labels in `guide_axis_nested()` can be split into equal lengths. #> ℹ Is \"[^[:alnum:]]+\" the correct `sep` argument? ggplot(ToothGrowth, aes(interaction(dose, supp, sep = \";\"), y = len)) + geom_jitter(width = 0.2) + labs( y = \"Tooth Length\", x = \"Dose / Supplement type\" ) + guides(x = guide_axis_nested(sep = \";\"))"},{"path":"https://teunbrand.github.io/gguidance/articles/axes.html","id":"manual-ranges","dir":"Articles","previous_headings":"Nested axes","what":"Manual ranges","title":"Axes","text":"alternative inferring ranges labels, manually set ranges. can use general annotation. Every range parametrised range_start range_end location. Optionally, can specify range_name make labels. , ’re using presidential dataset provide annotations economics dataset. Alternatively, can use range_data range_mapping arguments similar way layers. can see example ranges dodged. automatically occurs ranges overlap one another. override dodging ranges, one can set level variable range_mapping, use range_level directly.","code":"econ <- ggplot(economics, aes(date, unemploy)) + geom_line() + labs(x = \"Date\", y = \"Unemployment\") + # To prevent the last label from being cut off theme(plot.margin = margin(5.5, 11, 5.5, 5.5)) econ + guides(x = guide_axis_nested( range_start = presidential$start, range_end = presidential$end, range_name = presidential$name )) econ + guides(x = guide_axis_nested( range_data = presidential, range_mapping = aes(start = start, end = end, name = name) )) econ + guides(x = guide_axis_nested( range_data = presidential, range_mapping = aes( start = start, end = end, name = name, level = rep(3:1, length.out = nrow(presidential)) ) ))"},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/articles/axes.html","id":"brackets","dir":"Articles","previous_headings":"Nested axes > Styling","what":"Brackets","title":"Axes","text":"plain line available option displaying ranges. selection brackets choose , one \"square\" bracket. width height bracket occupies, can set bracket_size argument. brackets can specified three ways: (1) can constructed bracket function, (2) can string naming function without bracket_-prefix (3) can give 2-column matrix line coordinates. option (2), functions take parameters influence example curvature brackets, , can use function instead string need tweak. , brackets come {gguidance} displayed. option (3), example shows can describe bracket 2-column matrix. Note horizontal axes, 1st column y-direction 2nd column x-direction. vertical axes, flipped.","code":"econ + guides(x = guide_axis_nested( range_data = presidential, range_mapping = aes(start = start, end = end, name = name), bracket = \"square\", bracket_size = unit(1, \"mm\") )) # Listing all the bracket names and their functions bracket_list <- list( \"sigmoid\" = bracket_sigmoid(), \"atan\" = bracket_atan(), \"curvy\" = bracket_curvy(), \"line\" = bracket_line(), \"round\" = bracket_round(), \"chevron\" = bracket_chevron(), \"square\" = bracket_square() ) # Reshaping data type <- rep.int(names(bracket_list), lengths(bracket_list) / 2) brackets <- as.data.frame(do.call(rbind, bracket_list)) brackets <- transform( brackets, type = type, x = (x / 2) + match(type, names(bracket_list)) - 0.25 ) # Plotting brackets ggplot(brackets, aes(y, x, group = type)) + geom_line() + scale_y_continuous( breaks = seq_along(bracket_list), labels = names(bracket_list) ) + theme(panel.grid.major = element_blank()) zigzag <- seq(0, 1, length.out = 10) zigzag <- cbind(x = seq_along(zigzag) %% 2, y = zigzag) econ + guides(x = guide_axis_nested( range_data = presidential, range_mapping = aes(start = start, end = end, name = name), bracket = zigzag, bracket_size = unit(1, \"mm\") ))"},{"path":"https://teunbrand.github.io/gguidance/articles/axes.html","id":"theming","dir":"Articles","previous_headings":"Nested axes > Styling","what":"Theming","title":"Axes","text":"styling brackets inherit relevant axis.ticks.{x/y}.{position} theme element. styling text inherit relevant axis.text.{x/y}.{position} theme element. style elements separately parent, can use bracket_theme deep_text arguments. Moreover, can provide list elements deep_text bracket_theme style elements per-level basis even greater control. Worth mentioning: hjust parameter text relative range occupies.","code":"econ + guides(x = guide_axis_nested( range_data = presidential, range_mapping = aes(start = start, end = end, name = name), deep_text = element_text(colour = \"red\"), bracket_theme = element_line(linetype = \"dotted\") )) econ + guides(x = guide_axis_nested( range_data = presidential, range_mapping = aes(start = start, end = end, name = name), deep_text = list(element_text(colour = \"red\", hjust = 0), # 1st level element_text(face = \"bold\", hjust = 1)), # 2nd level bracket_theme = list(element_line(linetype = \"dotted\"), # 1st level element_line(linewidth = 1)) # 2nd level ))"},{"path":"https://teunbrand.github.io/gguidance/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Teun van den Brand. Author, maintainer.","code":""},{"path":"https://teunbrand.github.io/gguidance/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"van den Brand T (2023). gguidance: Extended guide options 'ggplot2'. R package version 0.0.0.9000, https://teunbrand.github.io/gguidance/.","code":"@Manual{, title = {gguidance: Extended guide options for 'ggplot2'}, author = {Teun {van den Brand}}, year = {2023}, note = {R package version 0.0.0.9000}, url = {https://teunbrand.github.io/gguidance/}, }"},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"gguidance-","dir":"","previous_headings":"","what":"Extended guide options for ggplot2","title":"Extended guide options for ggplot2","text":"Warning ’re looking experimental branch explores guide extensions upcoming ggproto overhaul ggplot2. goal gguidance provide additional guides ggplot2 ecosystem. Please note repo still worked , probably usable, isn’t finished.","code":""},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Extended guide options for ggplot2","text":"can install development version gguidance GitHub :","code":"# install.package(\"pak\") pak::pak(\"tidyverse/ggplot2\") # Installs development version of ggplot2 pak::pak(\"teunbrand/gguidance@main\") # Installs this package"},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"overview","dir":"","previous_headings":"","what":"Overview","title":"Extended guide options for ggplot2","text":"table contents package’s utilities: Cross legend String legend Capped colour bar Violin colour bar Histogram colour bar Subtitles Minor ticks Capping Ranges Table Regular Plus Zebra","code":""},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"examples","dir":"","previous_headings":"","what":"Examples","title":"Extended guide options for ggplot2","text":"Let’s first set basic plot experiment ","code":"library(gguidance) #> Loading required package: ggplot2 p <- ggplot(mpg, aes(displ, hwy)) + geom_point() + labs( x = \"Engine displacement\", y = \"Highway miles per gallon\" ) + theme(axis.line = element_line())"},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"cross-legend","dir":"","previous_headings":"Examples > Legends","what":"Cross legend","title":"Extended guide options for ggplot2","text":"‘cross legend’ can show two variables single legend.","code":"p + aes(colour = paste(cyl, year)) + guides(colour = \"legend_cross\")"},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"string-legend","dir":"","previous_headings":"Examples > Legends","what":"String legend","title":"Extended guide options for ggplot2","text":"string legend doesn’t display keys, colours labels.","code":"p + aes(colour = class) + guides(colour = \"legend_string\")"},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"capped-colour-bar","dir":"","previous_headings":"Examples > Colour bars","what":"Capped colour bar","title":"Extended guide options for ggplot2","text":"capped colour bar:","code":"p + aes(colour = cty) + scale_colour_viridis_c(guide = \"colourbar_cap\")"},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"violin-colour-bar","dir":"","previous_headings":"Examples > Colour bars","what":"Violin colour bar","title":"Extended guide options for ggplot2","text":"Using violin colour guide:","code":"p + aes(colour = cty) + scale_colour_viridis_c(guide = guide_colour_violin(density = mpg$cty))"},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"histogram-colour-bar","dir":"","previous_headings":"Examples > Colour bars","what":"Histogram colour bar","title":"Extended guide options for ggplot2","text":"Using histogram colour guide:","code":"p + aes(colour = cty) + scale_colour_viridis_c( guide = guide_colour_histogram(hist = hist(mpg$cty, breaks = 10)) )"},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"subtitles","dir":"","previous_headings":"Examples > Axes","what":"Subtitles","title":"Extended guide options for ggplot2","text":"Using subtitles.","code":"p + guides(x = guide_axis_extend(subtitle = c(\"Less\", \"More\")))"},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"minor-ticks","dir":"","previous_headings":"Examples > Axes","what":"Minor ticks","title":"Extended guide options for ggplot2","text":"Using minor ticks.","code":"p + guides(x = \"axis_minor\")"},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"capping","dir":"","previous_headings":"Examples > Axes","what":"Capping","title":"Extended guide options for ggplot2","text":"Using capped lines.","code":"p + guides(x = \"axis_cap\")"},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"ranges","dir":"","previous_headings":"Examples > Axes","what":"Ranges","title":"Extended guide options for ggplot2","text":"bracketed ranges.","code":"boxplot <- ggplot(mpg, aes(class, displ)) + geom_boxplot() + labs( x = \"Type of car\", y = \"Engine displacement\" ) boxplot + guides(x = guide_axis_nested( range_start = c(0.5, 3.5), range_end = c(4.5, 6.5), range_name = c(\"First range\", \"Second range\"), bracket = \"square\" ))"},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"table","dir":"","previous_headings":"Examples > Axes","what":"Table","title":"Extended guide options for ggplot2","text":"Using table axis guide.","code":"# Creating summary table my_table <- lapply(split(mpg[, c(\"displ\", \"cty\", \"hwy\")], mpg$class), colMeans) my_table <- as.data.frame(do.call(rbind, my_table)) my_table[] <- lapply(my_table, scales::number, accuracy = 0.01) my_table$class <- rownames(my_table) # Use summary table as axis guide boxplot + guides(x = guide_axis_table(table = my_table, key_col = class))"},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"regular","dir":"","previous_headings":"Examples > Grids","what":"Regular","title":"Extended guide options for ggplot2","text":"Like vanilla panel grid, options breaks appear. , categories.","code":"boxplot + coord_guided(guide_grid(x_breaks = breaks_between()))"},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"plus","dir":"","previous_headings":"Examples > Grids","what":"Plus","title":"Extended guide options for ggplot2","text":"Subtler grid lines drawing intersections, making ‘plus’ symbol.","code":"p + coord_guided(\"grid_plus\")"},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"zebra","dir":"","previous_headings":"Examples > Grids","what":"Zebra","title":"Extended guide options for ggplot2","text":"Alternating stripes breaks.","code":"boxplot + coord_guided(\"grid_zebra\") + theme(panel.grid.major.x = element_line(alpha(\"grey50\", 0.1)))"},{"path":"https://teunbrand.github.io/gguidance/reference/bracket_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Bracket options — bracket_options","title":"Bracket options — bracket_options","text":"functions construct various sorts brackets. construct matrix can supplied bracket argument guide_axis_nested().","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/bracket_options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bracket options — bracket_options","text":"","code":"bracket_sigmoid(curvature = 10, n = 100) bracket_atan(curvature = 5, n = 100) bracket_curvy(angle = 225, n = 100) bracket_line() bracket_round(angle = 180, n = 100) bracket_chevron() bracket_square()"},{"path":"https://teunbrand.github.io/gguidance/reference/bracket_options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bracket options — bracket_options","text":"curvature numeric(1) controls curliness bracket. precisely, used construct sequence seq(-curvature, curvature, length.= n) logistic arctangent functions evaluated. n integer(1) number points use bracket. angle numeric(1): angle degrees circle piece drawn. bracket_curvy(), angle 180 270.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/bracket_options.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bracket options — bracket_options","text":" coordinates points brackets.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/bracket_options.html","id":"functions","dir":"Reference","previous_headings":"","what":"Functions","title":"Bracket options — bracket_options","text":"bracket_sigmoid(): Two sigmoid curves stacked top one another form bracket. bracket_atan(): Two arctangent curves stacked top one another form bracket. bracket_curvy(): Four circular arcs make bracket. bracket_line(): simple line bracket. n = 2 points. bracket_round(): One circular arc makes bracket. bracket_chevron(): chevron (V-shape) makes bracket. n = 3 points. bracket_square(): square bracket. n = 4 points.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/bracket_options.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bracket options — bracket_options","text":"","code":"plot(bracket_sigmoid(), type = 'l')"},{"path":"https://teunbrand.github.io/gguidance/reference/breaks_between.html","id":null,"dir":"Reference","previous_headings":"","what":"Breaks between discrete categories — breaks_between","title":"Breaks between discrete categories — breaks_between","text":"function factory returns function placing breaks discrete categories use grid guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/breaks_between.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Breaks between discrete categories — breaks_between","text":"","code":"breaks_between(extremes = TRUE)"},{"path":"https://teunbrand.github.io/gguidance/reference/breaks_between.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Breaks between discrete categories — breaks_between","text":"extremes logical(1) whether breaks placed first last category. TRUE, returned. FALSE, omitted.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/breaks_between.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Breaks between discrete categories — breaks_between","text":"function can passed grid guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/breaks_between.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Breaks between discrete categories — breaks_between","text":"function used scale_{aes}_{type}(breaks = ...) input.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/breaks_between.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Breaks between discrete categories — breaks_between","text":"","code":"# By default, before and after breaks are included breaks_between()(c(\"A\", \"B\", \"C\")) #> [1] 0.5 1.5 2.5 3.5 # Only between categories breaks_between(FALSE)(c(\"A\", \"B\", \"C\")) #> [1] 1.5 2.5 # Continuous input returns waiver breaks_between()(1:3) #> list() #> attr(,\"class\") #> [1] \"waiver\""},{"path":"https://teunbrand.github.io/gguidance/reference/coord_guided.html","id":null,"dir":"Reference","previous_headings":"","what":"Cartesian coordinates with grid guides. — coord_guided","title":"Cartesian coordinates with grid guides. — coord_guided","text":"coordinate system offers additional flexibility able set guide panel grid.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/coord_guided.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cartesian coordinates with grid guides. — coord_guided","text":"","code":"coord_guided( guide = NULL, xlim = NULL, ylim = NULL, ratio = NULL, expand = TRUE, clip = \"on\", default = FALSE )"},{"path":"https://teunbrand.github.io/gguidance/reference/coord_guided.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cartesian coordinates with grid guides. — coord_guided","text":"guide object giving guide draw grid . Can constructed using functions listed 'See Also' section. xlim, ylim Limits x y axes. ratio Either NULL (default) numeric(1). numeric(1), locks aspect ratio panels, expressed y / x. expand TRUE, default, adds small expansion factor limits ensure data axes overlap. FALSE, limits taken exactly data xlim/ylim. clip drawing clipped extent plot panel? setting \"\" (default) means yes, setting \"\" means . cases, default \"\" changed, setting clip = \"\" can cause unexpected results. allows drawing data points anywhere plot, including plot margins. limits set via xlim ylim data points fall outside limits, data points may show places axes, legend, plot title, plot margins. default default coordinate system? FALSE (default), replacing coordinate system another one creates message alerting user coordinate system replaced. TRUE, warning suppressed.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/coord_guided.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cartesian coordinates with grid guides. — coord_guided","text":" ggproto object can added plot.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/coord_guided.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cartesian coordinates with grid guides. — coord_guided","text":"","code":"# Either choose a guide by name... ggplot(mpg, aes(displ, hwy)) + geom_point() + coord_guided(guide = \"grid_zebra\") # ... or using a constructor ggplot(mpg, aes(displ, hwy)) + geom_point() + coord_guided(guide = guide_grid_zebra())"},{"path":"https://teunbrand.github.io/gguidance/reference/elements_text.html","id":null,"dir":"Reference","previous_headings":"","what":"List of theme elements — elements_text","title":"List of theme elements — elements_text","text":"convenience function constructing list text theme elements. can take vector input arguments pass ith value vector ith call function.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/elements_text.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List of theme elements — elements_text","text":"","code":"elements_text( family = NULL, face = NULL, colour = NULL, size = NULL, hjust = NULL, vjust = NULL, angle = NULL, lineheight = NULL, color = NULL, margin = NULL, debug = NULL, inherit.blank = FALSE )"},{"path":"https://teunbrand.github.io/gguidance/reference/elements_text.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List of theme elements — elements_text","text":"family Font family face Font face (\"plain\", \"italic\", \"bold\", \"bold.italic\") colour, color Line/border colour. Color alias colour. size text size pts. hjust Horizontal justification (\\([0, 1]\\)) vjust Vertical justification (\\([0, 1]\\)) angle Angle (\\([0, 360]\\)) lineheight Line height margin Margins around text. See margin() details. creating theme, margins placed side text facing towards center plot. debug TRUE, aids visual debugging drawing solid rectangle behind complete text area, point label anchored. inherit.blank element inherit existence element_blank among parents? TRUE existence blank element among parents cause element blank well. FALSE blank parent element ignored calculating final element state.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/elements_text.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List of theme elements — elements_text","text":"list objects.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/elements_text.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"List of theme elements — elements_text","text":"NA NULL values silently dropped. want pass transparent colour argument, recommended use \"transparent\" instead. dropping NAs serve purpose can skip providing argument text element positions NAs occur.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/elements_text.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List of theme elements — elements_text","text":"","code":"# Simply have different colours for text elements_text(colour = c(\"blue\", \"red\")) #> [[1]] #> List of 11 #> $ family : NULL #> $ face : NULL #> $ colour : chr \"blue\" #> $ size : NULL #> $ hjust : NULL #> $ vjust : NULL #> $ angle : NULL #> $ lineheight : NULL #> $ margin : NULL #> $ debug : NULL #> $ inherit.blank: logi FALSE #> - attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> #> [[2]] #> List of 11 #> $ family : NULL #> $ face : NULL #> $ colour : chr \"red\" #> $ size : NULL #> $ hjust : NULL #> $ vjust : NULL #> $ angle : NULL #> $ lineheight : NULL #> $ margin : NULL #> $ debug : NULL #> $ inherit.blank: logi FALSE #> - attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> # More complicated case elements_text( # 2nd text will *not* have a family set family = c(\"mono\", NA, \"sans\"), # Arguments that don't take scalars can take lists. margin = list(NULL, margin(t = 5)) ) #> [[1]] #> List of 11 #> $ family : chr \"mono\" #> $ face : NULL #> $ colour : NULL #> $ size : NULL #> $ hjust : NULL #> $ vjust : NULL #> $ angle : NULL #> $ lineheight : NULL #> $ margin : NULL #> $ debug : NULL #> $ inherit.blank: logi FALSE #> - attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> #> [[2]] #> List of 11 #> $ family : NULL #> $ face : NULL #> $ colour : NULL #> $ size : NULL #> $ hjust : NULL #> $ vjust : NULL #> $ angle : NULL #> $ lineheight : NULL #> $ margin : 'margin' num [1:4] 5points 0points 0points 0points #> ..- attr(*, \"unit\")= int 8 #> $ debug : NULL #> $ inherit.blank: logi FALSE #> - attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> #> [[3]] #> List of 11 #> $ family : chr \"sans\" #> $ face : NULL #> $ colour : NULL #> $ size : NULL #> $ hjust : NULL #> $ vjust : NULL #> $ angle : NULL #> $ lineheight : NULL #> $ margin : NULL #> $ debug : NULL #> $ inherit.blank: logi FALSE #> - attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #>"},{"path":"https://teunbrand.github.io/gguidance/reference/gguidance-package.html","id":null,"dir":"Reference","previous_headings":"","what":"gguidance: Extended guide options for 'ggplot2' — gguidance-package","title":"gguidance: Extended guide options for 'ggplot2' — gguidance-package","text":"'ggplot2' extension focusses expanding plotter's arsenal guides, axes, legends colour bars. brings various improvements existing guides re-implementation, well adding novel guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gguidance-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"gguidance: Extended guide options for 'ggplot2' — gguidance-package","text":"Maintainer: Teun van den Brand tahvdbrand@gmail.com (ORCID)","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gguidance_extensions.html","id":null,"dir":"Reference","previous_headings":"","what":"ggproto objects in gguidance — CoordGuided","title":"ggproto objects in gguidance — CoordGuided","text":"gguidance package relies extension system ggplot2 ggproto class objects, allow cross-package inheritance objects geoms, stats, facets, scales coordinate systems. purpose making plots, users invited wholly ignore objects, since interacting objects preferred various constructor functions. gguidance package introduces new ggproto class support variations axes, legends colourbars.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_cap.html","id":null,"dir":"Reference","previous_headings":"","what":"Axis guide with capped axis line — guide_axis_cap","title":"Axis guide with capped axis line — guide_axis_cap","text":"similar regular axis guide, addition axis line can capped default, axis line capped extreme breaks, options available.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_cap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Axis guide with capped axis line — guide_axis_cap","text":"","code":"guide_axis_cap(cap_lower = min, cap_upper = max, ...)"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_cap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Axis guide with capped axis line — guide_axis_cap","text":"cap_lower, cap_upper way set lower upper ranges axis capping Can one following: NULL perform axis capping. function takes break positions input returns lower upper boundary. Note also discrete scales, inputs mapped breaks, numeric. function input can also given lambda syntax. numeric value, data units, lower upper boundaries. object set boundaries independent data. ... Arguments passed guide_axis_extend subtitle character() expression() giving subtitle guide. NULL (default), subtitle shown. length(subtitle) > 1, text distributed axis hjust setting ignored. subtitle.theme object object controlling appearance subtitle argument. default, inherits relevant axis.text.{x/y}.{position} theme setting. colour,color character(1) valid colour simultaneously changing colour axis text, axis ticks axis line. NULL (default), inherit colours directly theme. Otherwise, theme settings overruled. minor_size numeric(1) giving relative size minor axis ticks relative major axis ticks, defined axis.ticks.length.{x/y}.{position} theme element. NULL (default), minor axis ticks shown. major_size numeric(1) giving relative size major ticks relative axis.ticks.length.{x/y}.{position} theme element. NULL (default), major ticks drawn theme's length. title character string expression indicating title guide. NULL, title shown. default (waiver()), name scale object name specified labs() used title. check.overlap silently remove overlapping labels, (recursively) prioritizing first, last, middle labels. angle Compared setting angle theme() / element_text(), also uses heuristics automatically pick hjust vjust probably want. n.dodge number rows (vertical axes) columns (horizontal axes) used render labels. useful displaying labels otherwise overlap. order positive integer length 1 specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined secret algorithm. position guide drawn: one top, bottom, left, right.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_cap.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Axis guide with capped axis line — guide_axis_cap","text":" ggproto object can given guides() function, set guide argument position scale.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_cap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Axis guide with capped axis line — guide_axis_cap","text":"","code":"# A basic plot with axis lines p <- ggplot(mpg, aes(displ, hwy)) + geom_point() + theme(axis.line = element_line()) # By default, axis lines are truncated to extreme breaks p + guides(x = \"axis_cap\") # Turn off truncation at only one end p + guides(x = guide_axis_cap(cap_upper = NULL)) # Truncated at specific data values p + guides(x = guide_axis_cap(cap_lower = 3, cap_upper = 6)) # Truncated at some distance p + guides(x = guide_axis_cap( cap_lower = unit(3, \"cm\"), cap_upper = unit(1, \"npc\") - unit(3, \"cm\") )) # Truncation with functions take existing breaks as input p + guides(x = guide_axis_cap( cap_lower = function(x) x - 0.3, cap_upper = ~ .x + 0.3 # rlang lambda syntax function ))"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_extend.html","id":null,"dir":"Reference","previous_headings":"","what":"Extended axis guide — guide_axis_extend","title":"Extended axis guide — guide_axis_extend","text":"Like regular axis guides, extended axis guide visual representation position scales. offers various additional options axis capping, display minor ticks, subtitles convenient recolouring.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_extend.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extended axis guide — guide_axis_extend","text":"","code":"guide_axis_extend( title = waiver(), subtitle = NULL, subtitle.theme = element_text(), cap_lower = NULL, cap_upper = NULL, colour = NULL, color = NULL, major_size = NULL, minor_size = NULL, check.overlap = FALSE, angle = NULL, n.dodge = 1, order = 0, position = waiver(), ... )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_extend.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extended axis guide — guide_axis_extend","text":"title character string expression indicating title guide. NULL, title shown. default (waiver()), name scale object name specified labs() used title. subtitle character() expression() giving subtitle guide. NULL (default), subtitle shown. length(subtitle) > 1, text distributed axis hjust setting ignored. subtitle.theme object object controlling appearance subtitle argument. default, inherits relevant axis.text.{x/y}.{position} theme setting. cap_lower, cap_upper way set lower upper ranges axis capping Can one following: NULL perform axis capping. function takes break positions input returns lower upper boundary. Note also discrete scales, inputs mapped breaks, numeric. function input can also given lambda syntax. numeric value, data units, lower upper boundaries. object set boundaries independent data. colour, color character(1) valid colour simultaneously changing colour axis text, axis ticks axis line. NULL (default), inherit colours directly theme. Otherwise, theme settings overruled. major_size numeric(1) giving relative size major ticks relative axis.ticks.length.{x/y}.{position} theme element. NULL (default), major ticks drawn theme's length. minor_size numeric(1) giving relative size minor axis ticks relative major axis ticks, defined axis.ticks.length.{x/y}.{position} theme element. NULL (default), minor axis ticks shown. check.overlap silently remove overlapping labels, (recursively) prioritizing first, last, middle labels. angle Compared setting angle theme() / element_text(), also uses heuristics automatically pick hjust vjust probably want. n.dodge number rows (vertical axes) columns (horizontal axes) used render labels. useful displaying labels otherwise overlap. order positive integer length 1 specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined secret algorithm. position guide drawn: one top, bottom, left, right. ... Currently used.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_extend.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extended axis guide — guide_axis_extend","text":" ggproto object can given guides() function, set guide argument position scale.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_extend.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extended axis guide — guide_axis_extend","text":"","code":"# For examples with minor ticks or capping, please see: # ?guide_axis_minor # ?guide_axis_cap # A basic plot with an axis line p <- ggplot(mpg, aes(displ, hwy)) + geom_point() + theme(axis.line.x = element_line()) # Recolouring whole axis at once p + guides(x = guide_axis_extend(colour = \"red\")) # Adding a subtitle p + guides(x = guide_axis_extend(subtitle = \"Engine Displacement (L)\")) # Controlling subtitle appearance p + guides(x = guide_axis_extend( title = \"Engine Displacement\", subtitle = \"Litres\", subtitle.theme = element_text(face = \"italic\", hjust = 1) )) # Multiple subtitles are distributed over the axis p + guides(x = guide_axis_extend( subtitle = c(\"Less\", \"Middle\", \"More\") ))"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_minor.html","id":null,"dir":"Reference","previous_headings":"","what":"Axis guide with ticks for minor breaks — guide_axis_minor","title":"Axis guide with ticks for minor breaks — guide_axis_minor","text":"similar regular axis guide, addition also places tick marks minor break locations. minor_breaks argument scale_{x/y}_continuous() controls breaks placed.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_minor.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Axis guide with ticks for minor breaks — guide_axis_minor","text":"","code":"guide_axis_minor(minor_size = 0.75, major_size = 1, ...)"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_minor.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Axis guide with ticks for minor breaks — guide_axis_minor","text":"minor_size numeric(1) giving relative size minor axis ticks relative major axis ticks, defined axis.ticks.length.{x/y}.{position} theme element. NULL (default), minor axis ticks shown. major_size numeric(1) giving relative size major ticks relative axis.ticks.length.{x/y}.{position} theme element. NULL (default), major ticks drawn theme's length. ... Arguments passed guide_axis_extend subtitle character() expression() giving subtitle guide. NULL (default), subtitle shown. length(subtitle) > 1, text distributed axis hjust setting ignored. subtitle.theme object object controlling appearance subtitle argument. default, inherits relevant axis.text.{x/y}.{position} theme setting. cap_lower,cap_upper way set lower upper ranges axis capping Can one following: NULL perform axis capping. function takes break positions input returns lower upper boundary. Note also discrete scales, inputs mapped breaks, numeric. function input can also given lambda syntax. numeric value, data units, lower upper boundaries. object set boundaries independent data. colour,color character(1) valid colour simultaneously changing colour axis text, axis ticks axis line. NULL (default), inherit colours directly theme. Otherwise, theme settings overruled. title character string expression indicating title guide. NULL, title shown. default (waiver()), name scale object name specified labs() used title. check.overlap silently remove overlapping labels, (recursively) prioritizing first, last, middle labels. angle Compared setting angle theme() / element_text(), also uses heuristics automatically pick hjust vjust probably want. n.dodge number rows (vertical axes) columns (horizontal axes) used render labels. useful displaying labels otherwise overlap. order positive integer length 1 specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined secret algorithm. position guide drawn: one top, bottom, left, right.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_minor.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Axis guide with ticks for minor breaks — guide_axis_minor","text":" ggproto object can given guides() function, set guide argument position scale.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_minor.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Axis guide with ticks for minor breaks — guide_axis_minor","text":"","code":"# A basic plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() # Show minor ticks p + guides(x = \"axis_minor\") # Controlling tick size relative to normal ticks p + guides(x = guide_axis_minor(minor_size = 2)) # Only show minor ticks p + guides(x = guide_axis_minor(minor_size = 1, major_size = 0))"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_nested.html","id":null,"dir":"Reference","previous_headings":"","what":"Nested axis guide — guide_axis_nested","title":"Nested axis guide — guide_axis_nested","text":"Like regular axis guides, guide visual representation position scales. addition, axis guide extra options visualise various ranges scale.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_nested.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Nested axis guide — guide_axis_nested","text":"","code":"guide_axis_nested( range_data = NULL, range_mapping = NULL, range_start = NULL, range_end = NULL, range_name = NULL, range_level = NULL, sep = \"[^[:alnum:]]+\", bracket = \"line\", bracket_size = unit(2, \"mm\"), bracket_theme = element_line(), deep_text = element_text(), handle_oob = \"squish\", mirror_margin = TRUE, extend_discrete = 0.4, drop_zero = TRUE, ... )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_nested.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Nested axis guide — guide_axis_nested","text":"range_data optional data.frame containing relevant data ranges. range_mapping optional call aes() mappings start, end, name /level range_data argument. range_start, range_end Optional vectors giving starts ends ranges. Overrules start end aesthetic set range_mapping. range_name optional character vector giving labels use ranges. Overrules name mapping set range_mapping. range_level optional integer vector indicating depth range displayed. mostly useful overruling default bracket dodging. Overrules level mapping set range_mapping. sep character(1) acts 'regex' pattern split strings different layers. string splitting performed range_* arguments supplied. bracket One following: giving point coordinates bracket shapes, returned bracket functions. character(1) giving one bracket functions string. current options \"sigmoid\", \"atan\", \"curvy\", \"line\" (default), \"round\", \"chevron\" \"square\". bracket_size sets size bracket direction orthogonal axis. bracket_theme object object controlling appearance brackets. default, inherits axis.ticks.{x/y}.{position} theme setting. deep_text object object. Alternatively, list elements, every item applies layer text regular labels. See also elements_text() easily construct list text elements. handle_oob character(1) describing deal --bounds (oob) ranges. default \"squish\" deletes ranges start endpoints side limits, squeezes remainers fit inside limits. \"censor\" delete ranges part outside limits. \"none\" retain ranges regardless limits. mirror_margin logical(1) TRUE (default), mirror margin field axis.text.{x/y}.{position} theme setting. FALSE, margins taken -. option default margins may sometimes 0 text bracket, may look uncomfortable. extend_discrete numeric(1) giving much brackets extended beyond tick mark discrete scales. less 0.5 adjacent ranges touch. drop_zero logical(1) determining whether ranges difference, tolerance, start end point drawn. TRUE (default), ranges get brackets, FALSE, ranges get brackets. Useful set FALSE brackets drawn single breaks discrete scales. Note extend_discrete bearing drop_zero. ... Arguments passed guide_axis_extend subtitle character() expression() giving subtitle guide. NULL (default), subtitle shown. length(subtitle) > 1, text distributed axis hjust setting ignored. subtitle.theme object object controlling appearance subtitle argument. default, inherits relevant axis.text.{x/y}.{position} theme setting. cap_lower,cap_upper way set lower upper ranges axis capping Can one following: NULL perform axis capping. function takes break positions input returns lower upper boundary. Note also discrete scales, inputs mapped breaks, numeric. function input can also given lambda syntax. numeric value, data units, lower upper boundaries. object set boundaries independent data. colour,color character(1) valid colour simultaneously changing colour axis text, axis ticks axis line. NULL (default), inherit colours directly theme. Otherwise, theme settings overruled. minor_size numeric(1) giving relative size minor axis ticks relative major axis ticks, defined axis.ticks.length.{x/y}.{position} theme element. NULL (default), minor axis ticks shown. major_size numeric(1) giving relative size major ticks relative axis.ticks.length.{x/y}.{position} theme element. NULL (default), major ticks drawn theme's length. title character string expression indicating title guide. NULL, title shown. default (waiver()), name scale object name specified labs() used title. check.overlap silently remove overlapping labels, (recursively) prioritizing first, last, middle labels. angle Compared setting angle theme() / element_text(), also uses heuristics automatically pick hjust vjust probably want. n.dodge number rows (vertical axes) columns (horizontal axes) used render labels. useful displaying labels otherwise overlap. order positive integer length 1 specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined secret algorithm. position guide drawn: one top, bottom, left, right.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_nested.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Nested axis guide — guide_axis_nested","text":" ggproto object can given guides() function, set guide argument position scale.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_nested.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Nested axis guide — guide_axis_nested","text":"","code":"# A standard plot p <- ggplot(mpg, aes(class, displ)) + geom_boxplot() # If no `range_*` argument is given, the guide tries to split the labels p + aes(x = interaction(cyl, year)) + guides(x = \"axis_nested\") # For discrete axes, you can select the ranges either by numerical # equivalent, or by break level. p + guides(x = guide_axis_nested( range_start = c(\"2seater\", \"pickup\"), range_end = c(4, 7), range_name = c(\"First range\", \"Second range\") )) # If ranges overlap, they are automatically dodged. You can override this # by setting the `range_level` argument. p + guides(x = guide_axis_nested( range_start = c(1, 3), range_end = c(4, 6), range_name = c(\"First range\", \"Second range\") )) # You can change the appearance of the brackets. See ?bracket_options for # ready-to-go bracket functions. p + aes(x = interaction(cyl, year)) + guides(x = guide_axis_nested( bracket = \"curvy\", bracket_size = unit(5, \"mm\"), bracket_theme = element_line(colour = \"forestgreen\"), deep_text = element_text(colour = \"tomato\") ))"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Table as axis guide — guide_axis_table","title":"Table as axis guide — guide_axis_table","text":"Unlike regular axis, axis guide formats table aligned break positions scale. Axis tables along x-axis transposed.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Table as axis guide — guide_axis_table","text":"","code":"guide_axis_table( table = NULL, key_col = NULL, colnames = NULL, colnames_theme = element_text(inherit.blank = TRUE), colnames_position = c(\"top\", \"left\"), cell_text_theme = element_text(inherit.blank = TRUE), cell_padding = 0.25, cell_just = 0.5, sep_cell_rows = element_line(inherit.blank = TRUE), sep_cell_cols = element_line(inherit.blank = TRUE), sep_borders = element_line(inherit.blank = TRUE), sep_title = element_line(inherit.blank = TRUE), shade_odd = element_rect(inherit.blank = TRUE), shade_even = element_rect(inherit.blank = TRUE), shade_title = element_blank(), uniform_size = FALSE, align_panel = TRUE, ... )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Table as axis guide — guide_axis_table","text":"table data.frame key_col expression describing column table argument lined scale's labels. colnames character vector equal length ncol(table) setting titles columns. Can used set syntactically invalid, nicely formatted, names. colnames_theme (default) object controlling appearance text title cells. inherit axis.label.{x/y}.{position} setting plot's theme. colnames_position placement title cells. guide horizontal, can \"left\" \"right\". guide vertical, can \"top\" \"bottom\". cell_text_theme (default) object controlling appearance text regular cells. inherits axis.label.{x/y}.{position} setting plot's theme. cell_padding numeric(1) unit() length 1, indicating much text padded. setting numeric(1), padding size relative cell_text_theme's font size. cell_just numeric(1) 0 1, setting justification cells relative break positions scale. sep_cell_rows, sep_cell_cols (default) object controlling appearance lines separate regular cells interior table. Note rows cols refer rows columns table argument respectively. refer becomes row column final, possibly transposed, table. inherits panel.grid.major.{x/y} setting plot's theme. sep_borders (default) object controlling appearance lines separate outer regular cells plot exterior. inherits panel.grid.major.{x/y} setting plot's theme. sep_title (default) object controlling appearance lines separate regular cells title cells. inherits axis.line.{x/y}.{position} setting plot's theme. shade_odd, shade_even (default) object controlling appearance background fills 1-cell high, horizontal lines table. respectively inherit panel.background plot.background settings plot's theme. shade_title (default) object controlling appearance background fills title cells. uniform_size logical(1) TRUE, makes cells size direction orthogonal axis. align_panel logical(1) TRUE (default), aligns first last cells plotting panel. FALSE, first last cells size two breaks, usual. ... Currently use.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Table as axis guide — guide_axis_table","text":" ggproto object can given guides() function, set guide argument position scale.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_table.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Table as axis guide — guide_axis_table","text":"Currently, alignment text cell_just != 0.5 panel_align = TRUE slightly .","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Table as axis guide — guide_axis_table","text":"","code":"# Creating summary table tbl <- lapply(split(mpg[, c(\"displ\", \"cty\", \"hwy\")], mpg$cyl), colMeans) tbl <- as.data.frame(do.call(rbind, tbl)) tbl[] <- lapply(tbl, scales::number, accuracy = 0.01) tbl$cyl <- rownames(tbl) # A basic plot p <- ggplot(mpg, aes(factor(cyl), displ)) + geom_jitter() # Adding the table p + guides( x = guide_axis_table( table = tbl, key_col = cyl ) ) # Cell text can be formatted seperately faces <- c(\"bold\", rep(\"plain\", ncol(tbl) - 1)) colours <- c(\"red\", rep(\"black\", ncol(tbl) - 1)) p + guides( x = guide_axis_table( table = tbl, key_col = cyl, # Highlight specific variable. In this case, the 'displ' we put on y-axis cell_text_theme = elements_text(face = faces, colour = colours) ) ) # Titles can easily become too long, and can't be automatically adjusted p <- p + guides( x = guide_axis_table( table = tbl, key_col = cyl, colnames = c(\"Mean displ\", \"Mean cty\", \"Mean hwy\", \"Cylinders\") ) ) p # This can be remedied by setting the plot margins appropriately p + theme(plot.margin = margin(l = 32))"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colour_histogram.html","id":null,"dir":"Reference","previous_headings":"","what":"Histogram colour guide — guide_colour_histogram","title":"Histogram colour guide — guide_colour_histogram","text":"Like regular colour bar guides, histogram guide also shows continuous colour scales mapped values. addition, width guide can vary","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colour_histogram.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Histogram colour guide — guide_colour_histogram","text":"","code":"guide_colour_histogram( hist = list(), just = 0, ticks = element_line(\"grey80\"), ticks.length = unit(c(0, 1), \"npc\"), ticks.ontop = FALSE, ... )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colour_histogram.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Histogram colour guide — guide_colour_histogram","text":"hist One following: named list breaks counts elements, one returned hist() function. breaks element one longer counts element. numeric vecotr, forwarded hist() function plot = FALSE argument set. just numeric(1) [0, 1] range determine alignment histogram. valueo f 0 (default) sets left- bottom-alignment, whereas value 1 sets right- top-alignment. value 0.5 aligns histogram middle. ticks theme object rendering tick marks colourbar. Usually, object element_line() expected (default). element_blank(), tick marks drawn. backward compatibility, can also logical translates TRUE element_line() FALSE element_blank(). ticks.length numeric grid::unit() object specifying length tick marks colourbar. ticks.ontop logical(1) whether draw ticks top histogram (TRUE) underneath histogram (FALSE, default). ... Arguments passed ggplot2::guide_colourbar title character string expression indicating title guide. NULL, title shown. default (waiver()), name scale object name specified labs() used title. title.position character string indicating position title. One \"top\" (default vertical guide), \"bottom\", \"left\" (default horizontal guide), \"right.\" title.theme theme object rendering title text. Usually object element_text() expected. default, theme specified legend.title theme() theme. title.hjust number specifying horizontal justification title text. title.vjust number specifying vertical justification title text. label logical. TRUE labels drawn. FALSE labels invisible. label.position character string indicating position label. One \"top\", \"bottom\" (default horizontal guide), \"left\", \"right\" (default vertical guide). label.theme theme object rendering label text. Usually object element_text() expected. default, theme specified legend.text theme(). label.hjust numeric specifying horizontal justification label text. default standard text 0 (left-aligned) 1 (right-aligned) expressions. label.vjust numeric specifying vertical justification label text. barwidth numeric grid::unit() object specifying width colourbar. Default value legend.key.width legend.key.size theme() theme. barheight numeric grid::unit() object specifying height colourbar. Default value legend.key.height legend.key.size theme() theme. nbin numeric specifying number bins drawing colourbar. smoother colourbar results larger value. raster logical. TRUE colourbar rendered raster object. FALSE colourbar rendered set rectangles. Note graphics devices capable rendering raster image. frame theme object rendering frame drawn around bar. Usually, object element_rect() expected. element_blank() (default), frame drawn. frame.colour string specifying colour frame drawn around bar. backward compatibility, argument NULL, frame argument set element_rect(). frame.linewidth numeric specifying width frame drawn around bar millimetres. frame.linetype numeric specifying linetype frame drawn around bar. ticks.colour string specifying colour tick marks. ticks.linewidth numeric specifying width tick marks millimetres. draw.ulim logical specifying upper limit tick marks visible. draw.llim logical specifying lower limit tick marks visible. direction character string indicating direction guide. One \"horizontal\" \"vertical.\" default.unit character string indicating grid::unit() barwidth barheight. reverse logical. TRUE colourbar reversed. default, highest value top lowest value bottom order positive integer less 99 specifies order guide among multiple guides. controls order multiple guides displayed, contents guide . 0 (default), order determined secret algorithm. available_aes vector character strings listing aesthetics colourbar can drawn.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colour_histogram.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Histogram colour guide — guide_colour_histogram","text":" ggproto object can given guides() function, set guide argument colour fill scale.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colour_histogram.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Histogram colour guide — guide_colour_histogram","text":"","code":"# A standard plot with a continuous colour scale p <- ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) + scale_colour_viridis_c() # The guide can be given a variable of which to calculate a histogram p + guides(colour = guide_colour_histogram(mpg$cty)) # You can also pass the result of `hist()` for greater control p + guides(colour = guide_colour_histogram(hist(mpg$cty, breaks = 10))) # Alternatively, you can also pass a list manually p + guides(colour = guide_colour_histogram( hist = list(breaks = 0:4 * 10, counts = 1:4) )) # The `just` argument can be used to align the histogram elsewhere p + guides(colour = guide_colour_histogram(mpg$cty, just = 1))"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colour_violin.html","id":null,"dir":"Reference","previous_headings":"","what":"Violin colour guide — guide_colour_violin","title":"Violin colour guide — guide_colour_violin","text":"Like regular colour bar guides, violin guide also shows continuous colour scales mapped values. addition, width guide can vary. varying width can used display densities like violin plot.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colour_violin.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Violin colour guide — guide_colour_violin","text":"","code":"guide_colour_violin( density = list(), just = 0.5, ticks = element_line(\"grey80\"), ticks.length = unit(c(0, 1), \"npc\"), ticks.ontop = FALSE, ... )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colour_violin.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Violin colour guide — guide_colour_violin","text":"density One following: named list x y elements, one returned density() function. x y elements equal length least length 2. Infinite values x set scale's limits. numeric vector, forwarded density() function default arguments. just numeric(1) [0, 1] range determine alignment violin. value 0 sets left- bottom-alignment, whereas value 1 sets right- top-alignment. value 0.5 (default) aligns violin middle. ticks theme object rendering tick marks colourbar. Usually, object element_line() expected (default). element_blank(), tick marks drawn. backward compatibility, can also logical translates TRUE element_line() FALSE element_blank(). ticks.length numeric grid::unit() object specifying length tick marks colourbar. ticks.ontop logical(1) whether draw ticks op top violin (TRUE) underneath violin (FALSE, default). ... Arguments passed ggplot2::guide_colourbar title character string expression indicating title guide. NULL, title shown. default (waiver()), name scale object name specified labs() used title. title.position character string indicating position title. One \"top\" (default vertical guide), \"bottom\", \"left\" (default horizontal guide), \"right.\" title.theme theme object rendering title text. Usually object element_text() expected. default, theme specified legend.title theme() theme. title.hjust number specifying horizontal justification title text. title.vjust number specifying vertical justification title text. label logical. TRUE labels drawn. FALSE labels invisible. label.position character string indicating position label. One \"top\", \"bottom\" (default horizontal guide), \"left\", \"right\" (default vertical guide). label.theme theme object rendering label text. Usually object element_text() expected. default, theme specified legend.text theme(). label.hjust numeric specifying horizontal justification label text. default standard text 0 (left-aligned) 1 (right-aligned) expressions. label.vjust numeric specifying vertical justification label text. barwidth numeric grid::unit() object specifying width colourbar. Default value legend.key.width legend.key.size theme() theme. barheight numeric grid::unit() object specifying height colourbar. Default value legend.key.height legend.key.size theme() theme. nbin numeric specifying number bins drawing colourbar. smoother colourbar results larger value. raster logical. TRUE colourbar rendered raster object. FALSE colourbar rendered set rectangles. Note graphics devices capable rendering raster image. frame theme object rendering frame drawn around bar. Usually, object element_rect() expected. element_blank() (default), frame drawn. frame.colour string specifying colour frame drawn around bar. backward compatibility, argument NULL, frame argument set element_rect(). frame.linewidth numeric specifying width frame drawn around bar millimetres. frame.linetype numeric specifying linetype frame drawn around bar. ticks.colour string specifying colour tick marks. ticks.linewidth numeric specifying width tick marks millimetres. draw.ulim logical specifying upper limit tick marks visible. draw.llim logical specifying lower limit tick marks visible. direction character string indicating direction guide. One \"horizontal\" \"vertical.\" default.unit character string indicating grid::unit() barwidth barheight. reverse logical. TRUE colourbar reversed. default, highest value top lowest value bottom order positive integer less 99 specifies order guide among multiple guides. controls order multiple guides displayed, contents guide . 0 (default), order determined secret algorithm. available_aes vector character strings listing aesthetics colourbar can drawn.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colour_violin.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Violin colour guide — guide_colour_violin","text":" ggproto object can given guides() function, set guide argument colour fill scale.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colour_violin.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Violin colour guide — guide_colour_violin","text":"","code":"# A standard plot with continuous colour scale p <- ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) + scale_colour_viridis_c() # The guide can be given a variable of which to calculate density p + guides(colour = guide_colour_violin(mpg$cty)) # You can also pass the result of `density()` for greater control p + guides(colour = guide_colour_violin(density(mpg$cty, adjust = 0.5))) # Alternatively, you can also pass a list manually p + guides( colour = guide_colour_violin(density = list(x = c(-Inf, Inf), y = c(0, 1))) ) # The `just` argument can be used to align the density elsewhere p + guides(colour = guide_colour_violin(mpg$cty, just = 0))"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colourbar_cap.html","id":null,"dir":"Reference","previous_headings":"","what":"Capped colour bar guide — guide_colourbar_cap","title":"Capped colour bar guide — guide_colourbar_cap","text":"Like regular colour bar guides, capped colour bar guide also shows continuous colour scales mapped values. addition, guide allows 'cap' ends colour bar, can serve visual indicators scale squishing. cap filled colours extremes.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colourbar_cap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Capped colour bar guide — guide_colourbar_cap","text":"","code":"guide_colourbar_cap( cap_shape = \"triangle\", cap_size = NULL, cap_position = \"both\", ... ) guide_colorbar_cap( cap_shape = \"triangle\", cap_size = NULL, cap_position = \"both\", ... )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colourbar_cap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Capped colour bar guide — guide_colourbar_cap","text":"cap_shape character(1) indicating shape cap. Can one \"triangle\" (default), \"round\" \"arched\". cap_size object setting size cap. NULL (default), appropriate size chosen according cap_shape bar{width/height} argument. cap_position character(1) indicating end colour bar display cap(s). Can one \"lower\", \"upper\" \"\". ... Arguments passed ggplot2::guide_colourbar title character string expression indicating title guide. NULL, title shown. default (waiver()), name scale object name specified labs() used title. title.position character string indicating position title. One \"top\" (default vertical guide), \"bottom\", \"left\" (default horizontal guide), \"right.\" title.theme theme object rendering title text. Usually object element_text() expected. default, theme specified legend.title theme() theme. title.hjust number specifying horizontal justification title text. title.vjust number specifying vertical justification title text. label logical. TRUE labels drawn. FALSE labels invisible. label.position character string indicating position label. One \"top\", \"bottom\" (default horizontal guide), \"left\", \"right\" (default vertical guide). label.theme theme object rendering label text. Usually object element_text() expected. default, theme specified legend.text theme(). label.hjust numeric specifying horizontal justification label text. default standard text 0 (left-aligned) 1 (right-aligned) expressions. label.vjust numeric specifying vertical justification label text. barwidth numeric grid::unit() object specifying width colourbar. Default value legend.key.width legend.key.size theme() theme. barheight numeric grid::unit() object specifying height colourbar. Default value legend.key.height legend.key.size theme() theme. nbin numeric specifying number bins drawing colourbar. smoother colourbar results larger value. raster logical. TRUE colourbar rendered raster object. FALSE colourbar rendered set rectangles. Note graphics devices capable rendering raster image. frame theme object rendering frame drawn around bar. Usually, object element_rect() expected. element_blank() (default), frame drawn. frame.colour string specifying colour frame drawn around bar. backward compatibility, argument NULL, frame argument set element_rect(). frame.linewidth numeric specifying width frame drawn around bar millimetres. frame.linetype numeric specifying linetype frame drawn around bar. ticks theme object rendering tick marks colourbar. Usually, object element_line() expected (default). element_blank(), tick marks drawn. backward compatibility, can also logical translates TRUE element_line() FALSE element_blank(). ticks.colour string specifying colour tick marks. ticks.linewidth numeric specifying width tick marks millimetres. ticks.length numeric grid::unit() object specifying length tick marks colourbar. draw.ulim logical specifying upper limit tick marks visible. draw.llim logical specifying lower limit tick marks visible. direction character string indicating direction guide. One \"horizontal\" \"vertical.\" default.unit character string indicating grid::unit() barwidth barheight. reverse logical. TRUE colourbar reversed. default, highest value top lowest value bottom order positive integer less 99 specifies order guide among multiple guides. controls order multiple guides displayed, contents guide . 0 (default), order determined secret algorithm. available_aes vector character strings listing aesthetics colourbar can drawn.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colourbar_cap.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Capped colour bar guide — guide_colourbar_cap","text":" ggproto object can given guides() function, set guide argument colour fill scale.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colourbar_cap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Capped colour bar guide — guide_colourbar_cap","text":"","code":"# A standard plot with continuous colour scale p <- ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) + scale_colour_viridis_c() # By default, the bar is capped by equilateral triangles p + guides(colour = guide_colourbar_cap()) # This can be changed by setting a different cap shape p + guides(colour = guide_colourbar_cap(cap_shape = \"arched\")) # To cap just one end, use the `cap_position` argument p + guides(colour = guide_colourbar_cap(cap_position = \"upper\")) # The `cap_size` argument can be used to stretch or squish the cap p + guides(colour = guide_colourbar_cap(cap_size = unit(1, \"cm\"), cap_shape = \"round\"))"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid.html","id":null,"dir":"Reference","previous_headings":"","what":"Vanilla grid guide — guide_grid","title":"Vanilla grid guide — guide_grid","text":"guide draw regular panel grid, optional break adjustments.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Vanilla grid guide — guide_grid","text":"","code":"guide_grid( breaks = waiver(), minor_breaks = waiver(), x_breaks = waiver(), y_breaks = waiver(), x_minor_breaks = waiver(), y_minor_breaks = waiver(), ... )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Vanilla grid guide — guide_grid","text":"breaks default major breaks specification inherited x_breaks y_breaks arguments. minor_breaks default minor breaks specification inherited x_minor_breaks y_minor_breaks arguments. x_breaks, y_breaks Specifications major breaks. Inherits breaks argument. One : NULL breaks. waiver() default breaks computed scale. numeric vector positions. discrete scales, can also character vector. function takes limits input returns breaks output. Also accepts lambda function notation. x_minor_breaks, y_minor_breaks Specifications minor breaks. Inherits minor_breaks argument. One : NULL minor breaks. waiver() default minor breaks computed scale. numeric vector positions. discrete scales, can also character vector. function takes limits input returns vector minor breaks output. Also accepts lambda function notation. ... Currently use.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Vanilla grid guide — guide_grid","text":" ggproto object can given guides() function, set guide argument coord_guided().","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Vanilla grid guide — guide_grid","text":"","code":"# A standard plot p <- ggplot(mpg, aes(class, displ)) + geom_boxplot() # Giving a vector of x-breaks between discrete categories p + coord_guided(guide = guide_grid(x_breaks = 0.5:7.5)) # Identical to above, but passing a function for the x-breaks, and using # the `guides()` interface. p + coord_guided() + guides(grid = guide_grid(x_breaks = breaks_between()))"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid_plus.html","id":null,"dir":"Reference","previous_headings":"","what":"'Plus' grid guide — guide_grid_plus","title":"'Plus' grid guide — guide_grid_plus","text":"guide draws panel grid, displays grid lines points intersect. grid lines look like '+' symbol.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid_plus.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"'Plus' grid guide — guide_grid_plus","text":"","code":"guide_grid_plus( length = 1, length_major = NULL, length_minor = NULL, length_x_major = NULL, length_x_minor = NULL, length_y_major = NULL, length_y_minor = NULL, edge = TRUE, edge_x = NULL, edge_y = NULL, ... )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid_plus.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"'Plus' grid guide — guide_grid_plus","text":"length numeric(1) length arm plus symbol millimetres. Can Inf display regular lines. length_major, length_minor Inherits length argument specify lengths major minor grid lines. length_x_major, length_y_major Inherits length_major argument specify major x- y-grid lines. length_x_minor, length_y_minor Inherits length_minor argument specify minor x- y-grid lines. edge logical(1) whether draw grid lines panel edge (TRUE, default) (FALSE). edge_x, edge_y Inherits edge argument x- y-gridlines specifically. ... Arguments passed guide_grid breaks default major breaks specification inherited x_breaks y_breaks arguments. minor_breaks default minor breaks specification inherited x_minor_breaks y_minor_breaks arguments. x_breaks,y_breaks Specifications major breaks. Inherits breaks argument. One : NULL breaks. waiver() default breaks computed scale. numeric vector positions. discrete scales, can also character vector. function takes limits input returns breaks output. Also accepts lambda function notation. x_minor_breaks,y_minor_breaks Specifications minor breaks. Inherits minor_breaks argument. One : NULL minor breaks. waiver() default minor breaks computed scale. numeric vector positions. discrete scales, can also character vector. function takes limits input returns vector minor breaks output. Also accepts lambda function notation.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid_plus.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"'Plus' grid guide — guide_grid_plus","text":" ggproto object can given guides() function, set guide argument coord_guided().","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid_plus.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"'Plus' grid guide — guide_grid_plus","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() # A 'plus' grid p + coord_guided(guide = \"grid_plus\") # Setting larger plusses p + coord_guided(guide = guide_grid_plus(length = 4)) # Drawing one direction as regular lines p + coord_guided(guide = guide_grid_plus(length_y_major = Inf)) # Omitting the ticks at the edge p + coord_guided(guide = guide_grid_plus(edge = FALSE)) # Turning off the minor gridlines p + coord_guided(guide = guide_grid_plus(minor_breaks = NULL))"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid_zebra.html","id":null,"dir":"Reference","previous_headings":"","what":"Zebra grid — guide_grid_zebra","title":"Zebra grid — guide_grid_zebra","text":"guide draw panel grid alternating stripes, resembling stripes zebra, like pedestrian crosswalk.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid_zebra.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Zebra grid — guide_grid_zebra","text":"","code":"guide_grid_zebra( direction = \"x\", rect = element_rect(), rect_x = NULL, rect_y = NULL, at = \"major\", at_x = NULL, at_y = NULL, odd = TRUE, odd_x = NULL, odd_y = NULL, breaks = waiver(), x_breaks = waiver(), y_breaks = waiver(), ... )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid_zebra.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Zebra grid — guide_grid_zebra","text":"direction Either \"x\" \"y\" \"\" indicating direction zebra stripes drawn. \"\", orthogonal direction regular grid lines. rect element_rect element_blank object display zebra stripes. Internally inherits panel.grid.major theme setting, line's colour field becomes rectangle's fill field. rect_x, rect_y Inherits rect argument, x y directions respectively. One \"major\" (default), \"minor\" \"\" indicating breaks display stripes. at_x, at_y Inherits argument, x y directions respectively. odd logical(1) whether fill odd stripes (TRUE, default) even stripes (FALSE). odd_x, odd_y Inherits odd argument, x y directions respectively. breaks default major breaks specification inherited x_breaks y_breaks arguments. x_breaks, y_breaks Specifications major breaks. Inherits breaks argument. One : NULL breaks. waiver() default breaks computed scale. numeric vector positions. discrete scales, can also character vector. function takes limits input returns breaks output. Also accepts lambda function notation. ... Arguments passed guide_grid minor_breaks default minor breaks specification inherited x_minor_breaks y_minor_breaks arguments. x_minor_breaks,y_minor_breaks Specifications minor breaks. Inherits minor_breaks argument. One : NULL minor breaks. waiver() default minor breaks computed scale. numeric vector positions. discrete scales, can also character vector. function takes limits input returns vector minor breaks output. Also accepts lambda function notation.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid_zebra.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Zebra grid — guide_grid_zebra","text":" ggproto object can given guides() function, set guide argument coord_guided().","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid_zebra.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Zebra grid — guide_grid_zebra","text":"discrete scales, function internally default placing major breaks direction dimension levels. restore classic major breaks discrete scales, one can set relevant breaks_{x/y} = seq_along.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_grid_zebra.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Zebra grid — guide_grid_zebra","text":"","code":"# A standard plot p <- ggplot(economics, aes(date, unemploy)) + geom_line() # Adding a zebra grid p + coord_guided(guide = \"grid_zebra\") # Filling the even stripes p + coord_guided(guide = guide_grid_zebra(odd = FALSE)) # Including the minor breaks for zebra stripes p + coord_guided(guide = guide_grid_zebra(at = \"minor\")) # Customising the look of the stripes p + coord_guided(guide = guide_grid_zebra( rect = element_rect(fill = \"grey95\", colour = \"white\", linetype = \"dotted\") )) # Using zebra stripes as a gingham pattern p + coord_guided(guide = guide_grid_zebra(direction = 'both', at = \"minor\")) + theme(panel.grid.major = element_line(colour = alpha(\"white\", 0.5)))"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_legend_cross.html","id":null,"dir":"Reference","previous_headings":"","what":"Cross table legend guide — guide_legend_cross","title":"Cross table legend guide — guide_legend_cross","text":"Like regular legends, guide shows keys mapped onto values. useful displaying interaction two variables intuitively linear legend.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_legend_cross.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cross table legend guide — guide_legend_cross","text":"","code":"guide_legend_cross( sep = \"[^[:alnum:]]+\", label_order = c(\"row\", \"column\"), h_label.theme = element_text(), h_label.position = \"right\", v_label.theme = element_text(angle = 90, vjust = 0.5), v_label.position = \"bottom\", reverse = FALSE, ... )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_legend_cross.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cross table legend guide — guide_legend_cross","text":"sep character(1) NULL. : character(1) Acts 'regex' pattern split single set labels two parts. Defaults non-alphanumeric pattern. Note special regex characters need escaped, splitting period \"\\\\.\". NULL Disables string splitting, used combining two scales share labels single legend. See examples . label_order character(2) giving order dimensions first second label map . Can either c(\"row\", \"column\") c(\"column\", \"row\"). h_label.theme, v_label.theme (default) object controlling appearance horizontal (left/right) vertical (top/bottom) labels respectively. inherit legend.text setting plot's theme. h_label.position, v_label.position character(1) indicating position label. h_label.position can one \"left\" \"right\" (default), whereas v_label.position can one \"top\" \"bottom\" (default). reverse logical(2) logical(1) internally gets recycled length 2. reverse[1] TRUE, reverses order first label. reverse[2] TRUE, reverses order second label. Defaults c(FALSE, FALSE). ... Arguments passed ggplot2::guide_legend title character string expression indicating title guide. NULL, title shown. default (waiver()), name scale object name specified labs() used title. title.position character string indicating position title. One \"top\" (default vertical guide), \"bottom\", \"left\" (default horizontal guide), \"right.\" title.theme theme object rendering title text. Usually object element_text() expected. default, theme specified legend.title theme() theme. title.hjust number specifying horizontal justification title text. title.vjust number specifying vertical justification title text. keywidth numeric grid::unit() object specifying width legend key. Default value legend.key.width legend.key.size theme(). keyheight numeric grid::unit() object specifying height legend key. Default value legend.key.height legend.key.size theme(). direction character string indicating direction guide. One \"horizontal\" \"vertical.\" default.unit character string indicating grid::unit() keywidth keyheight. override.aes list specifying aesthetic parameters legend key. See details examples. order positive integer less 99 specifies order guide among multiple guides. controls order multiple guides displayed, contents guide . 0 (default), order determined secret algorithm.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_legend_cross.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cross table legend guide — guide_legend_cross","text":" ggproto object can given guides() function, set guide argument non-position scale.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_legend_cross.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Cross table legend guide — guide_legend_cross","text":"guide finds interaction two variables trying split compound label. Unfortunately, might require work format splittable labels. Moreover, one intends use guide show interaction , example: shapes colours, shape colour scales return compound labels.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_legend_cross.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cross table legend guide — guide_legend_cross","text":"","code":"# Display interaction by mapping a compound variable ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = paste(cyl, year))) + guides(colour = \"legend_cross\") # To make a cross legend for two scales, the plot must satisfy 2 criteria: # 1. Both scales need the same name/title. # 2. The guide needs `sep = NULL` to disable label splitting. # The easiest way to do this is to make one guide and feed it to both scales. guide <- guide_legend_cross(sep = NULL, title = \"My Title\") ggplot(mtcars, aes(mpg, disp)) + geom_point(aes(colour = factor(cyl), shape = factor(vs))) + guides(colour = guide, shape = guide)"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_legend_string.html","id":null,"dir":"Reference","previous_headings":"","what":"String legend — guide_legend_string","title":"String legend — guide_legend_string","text":"type legend shows colour fill mappings coloured text. draw keys guide_legend() .","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_legend_string.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"String legend — guide_legend_string","text":"","code":"guide_legend_string( title = waiver(), title.position = NULL, title.theme = NULL, title.hjust = NULL, title.vjust = NULL, label.theme = NULL, label.hjust = NULL, label.vjust = NULL, family = NULL, face = NULL, size = NULL, direction = NULL, override.aes = list(), nrow = NULL, ncol = NULL, byrow = FALSE, reverse = FALSE, order = 0, ... )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_legend_string.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"String legend — guide_legend_string","text":"title character string expression indicating title guide. NULL, title shown. default (waiver()), name scale object name specified labs() used title. title.position character string indicating position title. One \"top\" (default vertical guide), \"bottom\", \"left\" (default horizontal guide), \"right.\" title.theme theme object rendering title text. Usually object element_text() expected. default, theme specified legend.title theme() theme. title.hjust number specifying horizontal justification title text. title.vjust number specifying vertical justification title text. label.theme theme object rendering label text. Usually object element_text() expected. default, theme specified legend.text theme(). label.hjust numeric specifying horizontal justification label text. default standard text 0 (left-aligned) 1 (right-aligned) expressions. label.vjust numeric specifying vertical justification label text. family, face, size Shortcuts setting label.theme fields family, face size element_text(). direction character string indicating direction guide. One \"horizontal\" \"vertical.\" override.aes list specifying aesthetic parameters legend key. See details examples. nrow desired number rows legends. ncol desired number column legends. byrow logical. FALSE (default) legend-matrix filled columns, otherwise legend-matrix filled rows. reverse logical. TRUE order legends reversed. order positive integer less 99 specifies order guide among multiple guides. controls order multiple guides displayed, contents guide . 0 (default), order determined secret algorithm. ... ignored.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_legend_string.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"String legend — guide_legend_string","text":" ggproto object can given guides() function, set guide argument colour fill scale.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_legend_string.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"String legend — guide_legend_string","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = manufacturer)) + geom_point() # This guide gives the mapping as coloured labels p + guides(colour = \"legend_string\") # The controls are the same as in `guide_legend` p + guides(colour = guide_legend_string( ncol = 2, face = \"bold\", byrow = TRUE ))"},{"path":"https://teunbrand.github.io/gguidance/news/index.html","id":"gguidance-0009000","dir":"Changelog","previous_headings":"","what":"gguidance 0.0.0.9000","title":"gguidance 0.0.0.9000","text":"Added NEWS.md file track changes package.","code":""}] +[{"path":"https://teunbrand.github.io/gguidance/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 Teun van den Brand Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://teunbrand.github.io/gguidance/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Teun van den Brand. Author, maintainer.","code":""},{"path":"https://teunbrand.github.io/gguidance/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"van den Brand T (2024). gguidance: Extended guide options 'ggplot2'. R package version 0.0.0.9001, https://teunbrand.github.io/gguidance/.","code":"@Manual{, title = {gguidance: Extended guide options for 'ggplot2'}, author = {Teun {van den Brand}}, year = {2024}, note = {R package version 0.0.0.9001}, url = {https://teunbrand.github.io/gguidance/}, }"},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"gguidance","dir":"","previous_headings":"","what":"Extended guide options for ggplot2","title":"Extended guide options for ggplot2","text":"goal gguidance provide additional guide functionality ggplot2 ecosystem.","code":""},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Extended guide options for ggplot2","text":"can install development version gguidance GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"teunbrand/gguidance\")"},{"path":"https://teunbrand.github.io/gguidance/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Extended guide options for ggplot2","text":"Let’s first set basic plot experiment : gguidance package offers selection calls ‘complete guides’. complete guides can just drop-replacement regular guides, can specify using ggplot2’s guides() function using guide argument scales. example , ’re using two custom variants vanilla guides, namely guide_axis_custom() guide_colourbar_custom(). custom variants additional options allow greater degree customisation: axis guide option bidirectional ticks. colourbar automatically recognises --bounds values displays cap. Besides complete guides, gguidance also incomplete guides can composed. ggplot2::guide_axis_stack() axis composition function can used display multiple guides. , use ‘primitive’ guide (incomplete building block) display range axis. stacking regular axis primitive guide completed. gguidance package extends guide composition concept beyond axes types guides. example compose ‘sandwich’: central guide flanked two others. bracket primitive, matter aesthetic displays can re-use sandwich. ’ve yet write vignette composition.","code":"library(gguidance) #> Loading required package: ggplot2 base <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + labs( x = \"Engine displacement\", y = \"Highway miles per gallon\", col = \"City miles\\nper gallon\" ) + theme(axis.line = element_line()) base + scale_colour_viridis_c( limits = c(NA, 30), guide = \"colourbar_custom\" ) + guides( x = guide_axis_custom(bidi = TRUE) ) # A partial guide to display a bracket efficient_bracket <- primitive_bracket( # Keys determine what is displayed key = key_range_manual(start = 25, end = Inf, name = \"Efficient\"), bracket = \"square\", # We want vertical text theme = theme( legend.text = element_text(angle = 90, hjust = 0.5), axis.text.y.left = element_text(angle = 90, hjust = 0.5) ) ) base + guides(y = guide_axis_stack(\"axis\", efficient_bracket)) base + scale_colour_viridis_c( guide = compose_sandwich( middle = gizmo_density(), text = \"axis_custom\", opposite = efficient_bracket ) )"},{"path":"https://teunbrand.github.io/gguidance/reference/bracket_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Bracket options — bracket_options","title":"Bracket options — bracket_options","text":"functions construct various sorts brackets. construct matrix can supplied bracket argument primitive_bracket().","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/bracket_options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bracket options — bracket_options","text":"","code":"bracket_line() bracket_square() bracket_chevron() bracket_round(angle = 180, n = 100) bracket_sigmoid(curvature = 10, n = 100) bracket_atan(curvature = 5, n = 100) bracket_curvy(angle = 225, n = 100)"},{"path":"https://teunbrand.github.io/gguidance/reference/bracket_options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bracket options — bracket_options","text":"angle numeric(1): angle degrees circle piece drawn. bracket_curvy(), angle 180 270. n integer(1) number points use bracket. curvature numeric(1) controls curliness bracket. precisely, used construct sequence seq(-curvature, curvature, length.= n) logistic arctangent functions evaluated.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/bracket_options.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bracket options — bracket_options","text":" coordinates points brackets.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/bracket_options.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Bracket options — bracket_options","text":"designing custom bracket shapes, expectation columns number 0 1. first column follows direction guide whereas second column orthogonal direction.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/bracket_options.html","id":"functions","dir":"Reference","previous_headings":"","what":"Functions","title":"Bracket options — bracket_options","text":"bracket_line(): simple line bracket. n = 2 points. bracket_square(): square bracket. n = 4 points. bracket_chevron(): chevron (V-shape) makes bracket. n = 3 points. bracket_round(): One circular arc makes bracket. bracket_sigmoid(): Two sigmoid curves stacked top one another form bracket. bracket_atan(): Two arctangent curves stacked top one another form bracket. bracket_curvy(): Four circular arcs make bracket.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/bracket_options.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bracket options — bracket_options","text":"","code":"plot(bracket_sigmoid(), type = 'l')"},{"path":"https://teunbrand.github.io/gguidance/reference/cap_options.html","id":null,"dir":"Reference","previous_headings":"","what":"Cap options — cap_options","title":"Cap options — cap_options","text":"functions construct various sorts caps. construct matrix can supplied shape argument gizmo_barcap().","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/cap_options.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cap options — cap_options","text":"","code":"cap_triangle() cap_round(n = 100) cap_arch(n = 100) cap_ogee(n = 100) cap_none()"},{"path":"https://teunbrand.github.io/gguidance/reference/cap_options.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cap options — cap_options","text":"n number points use cap.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/cap_options.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cap options — cap_options","text":" coordinates points brackets.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/cap_options.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Cap options — cap_options","text":"designing custom cap shapes, expectation first point starts (0, 0) coordinate last point ends (0, 1) coordinate. first column follows orthogonal direction bar whereas second column follows direction bar.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/cap_options.html","id":"functions","dir":"Reference","previous_headings":"","what":"Functions","title":"Cap options — cap_options","text":"cap_triangle(): equilateral triangle n = 3 points. cap_round(): semicircle. cap_arch(): Two circular arcs forming equilateral Gothic arch. cap_ogee(): Four circular arcs forming 'ogee' arch. cap_none(): cap.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/cap_options.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cap options — cap_options","text":"","code":"plot(cap_arch(), type = 'l')"},{"path":"https://teunbrand.github.io/gguidance/reference/common_parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"common parameters in gguidance — common_parameters","title":"common parameters in gguidance — common_parameters","text":"collection common parameters needn't re-documented time.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/common_parameters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"common parameters in gguidance — common_parameters","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. available_aes vector listing aesthetics guide can build. direction indicating direction guide. Can \"horizontal\" \"vertical\". angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/compose_crux.html","id":null,"dir":"Reference","previous_headings":"","what":"Compose guides in a cross — compose_crux","title":"Compose guides in a cross — compose_crux","text":"guide composition central guide optionally surrounded guides four sides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/compose_crux.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compose guides in a cross — compose_crux","text":"","code":"compose_crux( key = NULL, centre = \"none\", left = \"none\", right = \"none\", top = \"none\", bottom = \"none\", args = list(), complete = FALSE, theme = NULL, theme_defaults = list(), reverse = FALSE, order = 0, title = waiver(), position = waiver(), available_aes = NULL )"},{"path":"https://teunbrand.github.io/gguidance/reference/compose_crux.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compose guides in a cross — compose_crux","text":"key standard key specification. key shared among guides NULL keys . See information linked topic. centre, left, right, top, bottom Guides use composition per position. guide can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. args arguments pass guides given either function string. complete whether treat composition complete guide. TRUE, title margin added result. FALSE (default), titles margins added. theme object style guide individually differently plot's theme settings. theme arguments guide overrides, combined , plot's theme. theme_defaults theme elements override undeclared theme arguments. reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. position guide drawn: one \"top\", \"bottom\", \"left\", \"right\". available_aes vector listing aesthetics guide can build.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/compose_crux.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compose guides in a cross — compose_crux","text":" guide object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/compose_crux.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compose guides in a cross — compose_crux","text":"","code":"NULL #> NULL"},{"path":"https://teunbrand.github.io/gguidance/reference/compose_ontop.html","id":null,"dir":"Reference","previous_headings":"","what":"Compose guides on top of one another — compose_ontop","title":"Compose guides on top of one another — compose_ontop","text":"guide can place place guides top one another.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/compose_ontop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compose guides on top of one another — compose_ontop","text":"","code":"compose_ontop( ..., args = list(), key = NULL, title = waiver(), angle = waiver(), theme = NULL, order = 0, position = waiver(), available_aes = NULL )"},{"path":"https://teunbrand.github.io/gguidance/reference/compose_ontop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compose guides on top of one another — compose_ontop","text":"... Guides stack composition. guide can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. args arguments pass guides given either function string. key standard key specification. key shared among guides NULL keys . See information linked topic. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". available_aes giving aesthetics must match guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/compose_ontop.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compose guides on top of one another — compose_ontop","text":" composite guide object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/compose_ontop.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compose guides on top of one another — compose_ontop","text":"","code":"# Using the ontop composition to get two types of ticks with different # lengths ggplot(mpg, aes(displ, hwy)) + geom_point() + guides(x = compose_ontop( guide_axis_custom( key_manual(c(2, 4, 6)), theme = theme( axis.ticks = element_line(colour = \"limegreen\"), axis.ticks.length = unit(11, \"pt\") ) ), guide_axis_custom( key_manual(c(3, 5, 7)), theme = theme( axis.ticks = element_line(colour = \"tomato\"), axis.ticks.length = unit(5.5, \"pt\") ) ) ))"},{"path":"https://teunbrand.github.io/gguidance/reference/compose_sandwich.html","id":null,"dir":"Reference","previous_headings":"","what":"Compose guides as a sandwich — compose_sandwich","title":"Compose guides as a sandwich — compose_sandwich","text":"guide composition middle guide flanked two parallel guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/compose_sandwich.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compose guides as a sandwich — compose_sandwich","text":"","code":"compose_sandwich( key = key_auto(), middle = gizmo_barcap(), text = \"none\", opposite = \"none\", args = list(), complete = TRUE, theme = NULL, theme_defaults = list(), reverse = FALSE, order = 0, title = waiver(), position = waiver(), available_aes = NULL )"},{"path":"https://teunbrand.github.io/gguidance/reference/compose_sandwich.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compose guides as a sandwich — compose_sandwich","text":"key standard key specification. key shared among guides NULL keys . See information linked topic. middle Guide use middle guide. guide can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. text, opposite Guides use legend.text.position location opposite side middle guide respectively. Guide specification middle argument. args arguments pass guides given either function string. complete whether treat composition complete guide. TRUE, title margin added result. FALSE (default), titles margins added. theme object style guide individually differently plot's theme settings. theme arguments guide overrides, combined , plot's theme. theme_defaults theme elements override undeclared theme arguments. reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. position guide drawn: one \"top\", \"bottom\", \"left\", \"right\". available_aes vector listing aesthetics guide can build.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/compose_sandwich.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compose guides as a sandwich — compose_sandwich","text":" guide object.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/compose_sandwich.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compose guides as a sandwich — compose_sandwich","text":"sandwich composition effectively crux composition lacking two opposing arms.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/compose_sandwich.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compose guides as a sandwich — compose_sandwich","text":"","code":"# A standard plot with a sandwich guide ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) + guides(colour = compose_sandwich( middle = \"colourbar\", text = \"axis_custom\", opposite = primitive_bracket(key = key_range_manual( start = c(10, 20), end = c(25, 30), name = c(\"A\", \"B\") )) ))"},{"path":"https://teunbrand.github.io/gguidance/reference/compose_stack.html","id":null,"dir":"Reference","previous_headings":"","what":"Compose guides as stack — compose_stack","title":"Compose guides as stack — compose_stack","text":"guide can stack guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/compose_stack.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compose guides as stack — compose_stack","text":"","code":"compose_stack( ..., args = list(), key = NULL, title = waiver(), side.titles = waiver(), angle = waiver(), theme = NULL, order = 0, drop = NULL, position = waiver(), available_aes = NULL )"},{"path":"https://teunbrand.github.io/gguidance/reference/compose_stack.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compose guides as stack — compose_stack","text":"... Guides stack composition. guide can specified one following: class object. returns class object. naming function, without guide_ primitive_ prefix. args arguments pass guides given either function string. key standard key specification. key shared among guides NULL keys . See information linked topic. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. side.titles giving labels titles displayed side stack. Set NULL display side titles. waiver(), attempt made extract titles guides use side titles. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. drop giving indices guides dropped facet requests labels drawn axes panels. default, NULL, drop every guide except first. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". available_aes giving aesthetics must match guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/compose_stack.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compose guides as stack — compose_stack","text":" guide object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/compose_stack.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compose guides as stack — compose_stack","text":"","code":"ggplot() + geom_function(fun = dnorm, xlim = c(-3, 3)) + guides(x = compose_stack( \"axis\", \"axis\", side.titles = c(\"first\", \"second\") )) + # Add margin to make room for side titles theme(plot.margin = margin(5.5, 5.5, 5.5, 11))"},{"path":"https://teunbrand.github.io/gguidance/reference/gguidance-package.html","id":null,"dir":"Reference","previous_headings":"","what":"gguidance: Extended guide options for 'ggplot2' — gguidance-package","title":"gguidance: Extended guide options for 'ggplot2' — gguidance-package","text":"'ggplot2' extension focusses expanding plotter's arsenal guides, axes, legends colour bars.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/gguidance-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"gguidance: Extended guide options for 'ggplot2' — gguidance-package","text":"Maintainer: Teun van den Brand tahvdbrand@gmail.com (ORCID)","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gguidance_extensions.html","id":null,"dir":"Reference","previous_headings":"","what":"ggproto objects in gguidance — Compose","title":"ggproto objects in gguidance — Compose","text":"gguidance package relies extension system ggplot2 ggproto class objects, allow cross-package inheritance objects geoms, stats, facets, scales coordinate systems. purpose making plots, users invited wholly ignore objects, since interacting objects preferred various constructor functions. gguidance package introduces new ggproto class support variations axes, legends colourbars.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_barcap.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: capped colour bar — gizmo_barcap","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":"guide displays colour bar optional caps either ends bar.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_barcap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":"","code":"gizmo_barcap( key = \"sequence\", shape = \"triangle\", size = NULL, show = NA, alpha = NA, oob = \"keep\", theme = NULL, position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_barcap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":"key sequence key specification. Defaults key_sequence(n = 15). Changing argument key_sequence() fine, changing key type advised. shape cap specification providing one following: cap , cap_triangle(). naming cap function without 'cap_'-prefix, e.g. \"round\". two column giving coordinates cap, like created cap functions cap_arch(). size setting size cap. NULL (default), cap size proportional shape coordinates legend.key.size theme setting. show control caps displayed ends bar. TRUE, caps always displayed. FALSE, caps never displayed. NA (default), caps displayed data range exceed limits. given , show[1] controls display lower end show[2] upper end. alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_barcap.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_barcap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: capped colour bar — gizmo_barcap","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() # Just a bar p + scale_colour_viridis_c(guide = gizmo_barcap()) # Caps show up when there is data outside the limits p + scale_colour_viridis_c( limits = c(10, 30), guide = gizmo_barcap() ) # The scale's out-of-bounds handler determines cap colour p + scale_colour_viridis_c( limits = c(10, 30), oob = scales::oob_squish, guide = gizmo_barcap() ) # Customising display of the guide p + scale_colour_viridis_c( oob = scales::oob_squish, guide = gizmo_barcap( shape = \"arch\", show = c(FALSE, TRUE), size = unit(2, \"cm\"), theme = theme(legend.key.height = unit(4, \"cm\")) ) ) + theme( legend.frame = element_rect(colour = \"black\"), legend.key.width = unit(0.5, \"cm\") )"},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_density.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: kernel density estimate — gizmo_density","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"guide displays kernel density estimate (KDE) aesthetic. aesthetic colour fill, shape reflect .","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_density.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"","code":"gizmo_density( key = \"sequence\", density = NULL, density.args = list(), density.fun = stats::density, just = 0.5, oob = \"keep\", alpha = NA, theme = NULL, position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_density.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"key sequence key binned key specification. density One following: NULL using kernel density estimation data values (default). vector feed density.fun function. named x y numeric elements equal length, one returned using density() function. Please note input expected scale-transformed space, original data space. density.args additional arguments density.fun argument. applies density provided . already. density.fun use kernel density estimation density argument provided list already. just 0 1. Use 0 bottom- left-aligned densities, use 1 top- right-aligned densities 0.5 violin shapes. oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_density.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: kernel density estimate — gizmo_density","text":" object.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_density.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"Non-finite values NA NaN ignored infinite values -Inf Inf squished limits.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_density.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: kernel density estimate — gizmo_density","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + scale_colour_viridis_c() # Density from plot data p + guides(colour = gizmo_density()) # Using bins instead of gradient p + guides(colour = gizmo_density(\"bins\")) # Providing custom values to compute density of p + guides(colour = gizmo_density(density = runif(1000, min = 5, max = 35))) # Providing a precomputed density p + guides(colour = gizmo_density(density = density(mpg$cty, adjust = 0.5))) # Alternatively, parameters may be passed through density.args p + guides(colour = gizmo_density(density.args = list(adjust = 0.5)))"},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_grob.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: custom grob — gizmo_grob","title":"Guide gizmo: custom grob — gizmo_grob","text":"guide displays user-provided grob.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_grob.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: custom grob — gizmo_grob","text":"","code":"gizmo_grob( grob, width = grobWidth(grob), height = grobHeight(grob), hjust = 0.5, vjust = 0.5, position = waiver() )"},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_grob.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: custom grob — gizmo_grob","text":"grob display. width, height [][grid::unit] setting allocated width height grob respectively. hjust, vjust 0 1 setting horizontal vertical justification grob used guide x y aesthetics. position guide drawn: one \"top\", \"bottom\", \"left\", \"right\".","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_grob.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: custom grob — gizmo_grob","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_grob.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: custom grob — gizmo_grob","text":"","code":"circle <- grid::circleGrob() # A standard plot with grob gizmos ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + guides( x.sec = gizmo_grob( circle, hjust = 0.75, width = unit(2, \"cm\"), height = unit(2, \"cm\") ), colour = gizmo_grob( circle, width = unit(1, \"cm\"), height = unit(1, \"cm\") ) )"},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_histogram.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: histogram — gizmo_histogram","title":"Guide gizmo: histogram — gizmo_histogram","text":"guide displays histogram aesthetic. aesthetic colour fill, shape reflect .","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_histogram.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: histogram — gizmo_histogram","text":"","code":"gizmo_histogram( key = \"sequence\", hist = NULL, hist.args = list(), hist.fun = graphics::hist, just = 1, oob = oob_keep, alpha = NA, theme = NULL, position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_histogram.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: histogram — gizmo_histogram","text":"key sequence key binned key specification. hist One following: NULL computing histograms data values (default). atomic feed hist.fun function. named breaks counts numeric items, breaks item exactly one element longer counts item. typical way construct list using hist() function. Please note input expected scale-transformed space, original data space. hist.args additional arguments hist.fun argument. applies hist provided already. hist.fun use computing histograms hist argument provided list already. just 0 1. Use 0 bottom- left-aligned histograms, use 1 top- right-aligned histograms 0.5 centred histograms. oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_histogram.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: histogram — gizmo_histogram","text":" object.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_histogram.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Guide gizmo: histogram — gizmo_histogram","text":"Non-finite values NA NaN ignored infinite values -Inf Inf squished limits.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_histogram.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: histogram — gizmo_histogram","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() + scale_colour_viridis_c() # Histogram from plot data p + guides(colour = gizmo_histogram()) # Using bins instead of gradient p + guides(colour = gizmo_histogram(\"bins\")) # Providing custom values to compute histogram p + guides(colour = gizmo_histogram(hist = runif(1000, min = 5, max = 35))) # Providing precomputed histogram p + guides(colour = gizmo_histogram(hist = hist(mpg$cty, breaks = 10))) # Alternatively, parameters may be passed through hist.args p + guides(colour = gizmo_histogram(hist.arg = list(breaks = 10)))"},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_stepcap.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmo: capped colour steps — gizmo_stepcap","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"guide displays binned variant colour bar optional caps either ends bar.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_stepcap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"","code":"gizmo_stepcap( key = \"bins\", shape = \"triangle\", size = NULL, show = NA, alpha = NA, oob = \"keep\", theme = NULL, position = waiver(), direction = NULL )"},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_stepcap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"key bins key specificiation. Defaults key_bins(even.steps = FALSE, show.limits = NULL). Changing arguments key_bins() fine, changing key type advised. shape cap specification providing one following: cap , cap_triangle(). naming cap function without 'cap_'-prefix, e.g. \"round\". two column giving coordinates cap, like created cap functions cap_arch(). size setting size cap. NULL (default), cap size proportional shape coordinates legend.key.size theme setting. show control caps displayed ends bar. TRUE, caps always displayed. FALSE, caps never displayed. NA (default), caps displayed data range exceed limits. given , show[1] controls display lower end show[2] upper end. alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". direction indicating direction guide. Can \"horizontal\" \"vertical\".","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_stepcap.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"GizmoStepcap object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/gizmo_stepcap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide gizmo: capped colour steps — gizmo_stepcap","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = cty)) + geom_point() # Just some recangles p + scale_colour_viridis_c(guide = gizmo_stepcap()) # Caps show up when there is data outside the limits p + scale_colour_viridis_c( limits = c(10, 30), guide = gizmo_stepcap() ) # The scale's out-of-bounds handler determines cap colour p + scale_colour_viridis_c( limits = c(10, 30), oob = scales::oob_squish, guide = gizmo_stepcap() ) # Customising the display of the guide p + scale_colour_viridis_c( oob = scales::oob_squish, guide = gizmo_stepcap( shape = \"round\", show = c(FALSE, TRUE), size = unit(1, \"cm\"), theme = theme(legend.key.height = unit(4, \"cm\")) ) ) + theme( legend.frame = element_rect(colour = \"black\"), legend.key.width = unit(0.5, \"cm\") )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide-composition.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide composition — guide-composition","title":"Guide composition — guide-composition","text":"Guide composition meta-guide orchestrating ensemble guides. , 'composing' guide useful visual reflection scale.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide-composition.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide composition — guide-composition","text":"","code":"new_compose( guides, args = list(), ..., available_aes = c(\"any\", \"x\", \"y\", \"r\", \"theta\"), call = caller_env(), super = Compose )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide-composition.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide composition — guide-composition","text":"guides guides wherein element one following: class object. returns class object. naming function, without guide_ primitive_ prefix. args arguments pass guides given either function string. ... Additional parameters pass new_guide(). available_aes giving aesthetics must match guides. call call display messages. super class object giving meta-guide composition.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide-composition.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide composition — guide-composition","text":" (sub-)class guide composes guides.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide-composition.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide composition — guide-composition","text":"","code":"# new_compose() is not intended to be used directly"},{"path":"https://teunbrand.github.io/gguidance/reference/guide-gizmos.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide gizmos — guide-gizmos","title":"Guide gizmos — guide-gizmos","text":"Guide gizmos speciality guide components specific one aesthetics display. Typically can composed guides guide primitives form complete guide.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide-primitives.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitives — guide-primitives","title":"Guide primitives — guide-primitives","text":"Guide primitives building blocks complex guides. , useful visual reflection scale. purpose combined one another form complex, complete guides reflect scale way.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide-primitives.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Guide primitives — guide-primitives","text":"guide primitives simple, flexible tailored one particular aesthetic. way can reused combined .","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_custom.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom axis guide — guide_axis_custom","title":"Custom axis guide — guide_axis_custom","text":"axis guide visual representation position scales can represent x, y, theta r aesthetics. differs guide_axis() can accept custom keys can act axis coord_radial() like guide_axis_theta().","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_custom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom axis guide — guide_axis_custom","text":"","code":"guide_axis_custom( key = NULL, title = waiver(), theme = NULL, n.dodge = 1, check.overlap = FALSE, angle = waiver(), cap = \"none\", bidi = FALSE, order = 0, position = waiver() )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_custom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom axis guide — guide_axis_custom","text":"key standard key specification. Defaults key_auto(). See information linked topic 'Details' section. title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. n.dodge positive setting number layers text labels can occupy avoid overlapping labels. check.overlap indicating whether check omit overlapping text. TRUE, first, last middle labels recursively prioritised order. FALSE, labels drawn. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. cap method cap axes. One following: one following: \"none\" perform capping. \"\" cap line ends extreme breaks. \"upper\" cap line upper extreme break. \"lower\" cap line lower extreme break. [1], TRUE equivalent \"\" FALSE equivalent \"none\" options . sorted [2n] even number members. lines drawn every odd-even pair. takes scale's breaks first argument, scale's limits second argument returns [2n] described . bidi : whether ticks drawn bidirectionally (TRUE) single direction (FALSE, default). order positive specifies order guide among multiple guides. controls order guides merged multiple guides position. 0 (default), order determined hashing indicative settings guide. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_custom.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Custom axis guide — guide_axis_custom","text":" object.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_custom.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Custom axis guide — guide_axis_custom","text":"hood, guide stack composition line, ticks labels primitives. set minor ticks, use key = \"minor\", use type argument key_manual() key_map(). use logarithmic axis, set key = \"log\".","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_axis_custom.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom axis guide — guide_axis_custom","text":"","code":"# A standard plot with custom keys p <- ggplot(mpg, aes(displ, hwy)) + geom_point() + scale_x_continuous( guide = guide_axis_custom(key = key_minor()) ) + scale_y_continuous( guide = guide_axis_custom(key = key_manual(c(20, 25, 30, 40))) ) p # Is translated to theta axis without fuss p + coord_radial() # To use as logarithmic axis: ggplot(msleep, aes(bodywt, brainwt)) + geom_point(na.rm = TRUE) + scale_x_continuous( transform = \"log10\", guide = guide_axis_custom(\"log\") )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colourbar_custom.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom colour bar guide — guide_colourbar_custom","title":"Custom colour bar guide — guide_colourbar_custom","text":"Similar guide_colourbar(), guide displays continuous colour fill aesthetics. additional options display caps end bar, depending --bounds values.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colourbar_custom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom colour bar guide — guide_colourbar_custom","text":"","code":"guide_colourbar_custom( title = waiver(), key = \"auto\", first_guide = \"axis_custom\", second_guide = first_guide, shape = \"triangle\", size = NULL, show = NA, nbin = 15, alpha = NA, reverse = FALSE, oob = scales::oob_keep, theme = NULL, position = waiver(), available_aes = c(\"colour\", \"fill\") )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colourbar_custom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom colour bar guide — guide_colourbar_custom","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. key sequence key specification. Defaults key_sequence(n = 15). Changing argument key_sequence() fine, changing key type advised. first_guide, second_guide Guides flank colour bar. guide can specified using one following: class object. returns class object. naming function, without guide_ primitive_ prefix. first_guide placed location specified legend.text.position theme setting. second_guide placed opposite position. second_guide label suppression mechanism, labels drawn guide. shape cap specification providing one following: cap , cap_triangle(). naming cap function without 'cap_'-prefix, e.g. \"round\". two column giving coordinates cap, like created cap functions cap_arch(). size setting size cap. NULL (default), cap size proportional shape coordinates legend.key.size theme setting. show control caps displayed ends bar. TRUE, caps always displayed. FALSE, caps never displayed. NA (default), caps displayed data range exceed limits. given , show[1] controls display lower end show[2] upper end. nbin positive determining many colours use colour gradient. alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". available_aes vector listing aesthetics guide can build.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colourbar_custom.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Custom colour bar guide — guide_colourbar_custom","text":" object","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colourbar_custom.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Custom colour bar guide — guide_colourbar_custom","text":"colours always rendered gradients, important use graphics device can render . can checked using check_device(\"gradients\").","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_colourbar_custom.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom colour bar guide — guide_colourbar_custom","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) # The colourbar shows caps when values are out-of-bounds (oob) p + scale_colour_viridis_c( limits = c(10, NA), guide = \"colourbar_custom\" ) # It also shows how oob values are handled p + scale_colour_viridis_c( limits = c(10, NA), oob = scales::oob_squish, guide = \"colourbar_custom\" ) # Adjusting the type of cap p + scale_colour_viridis_c( limits = c(10, 30), oob = scales::oob_squish, guide = guide_colourbar_custom(shape = \"round\") ) # One-sided ticks p + scale_colour_viridis_c( guide = guide_colourbar_custom(second_guide = \"none\") ) # Colour bar with minor breaks p + scale_colour_viridis_c( minor_breaks = breaks_width(1), guide = guide_colourbar_custom(key = \"minor\") ) #> Error in breaks_width(1): could not find function \"breaks_width\" # Using log ticks on a colourbar ggplot(msleep, aes(sleep_total, sleep_rem)) + geom_point(aes(colour = bodywt), na.rm = TRUE) + scale_colour_viridis_c( transform = \"log10\", guide = guide_colourbar_custom(key = \"log\") )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_coloursteps_custom.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom colour steps guide — guide_coloursteps_custom","title":"Custom colour steps guide — guide_coloursteps_custom","text":"Similar guide_coloursteps(), guide displays continuous colour fill aesthetics. additional options display caps end bar, depending --bounds values.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_coloursteps_custom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom colour steps guide — guide_coloursteps_custom","text":"","code":"guide_coloursteps_custom( title = waiver(), key = \"bins\", first_guide = \"labels\", second_guide = \"none\", shape = \"triangle\", size = NULL, show = NA, alpha = NA, reverse = FALSE, oob = scales::oob_keep, theme = NULL, position = waiver(), available_aes = c(\"colour\", \"fill\") )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_coloursteps_custom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom colour steps guide — guide_coloursteps_custom","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. key bins key specificiation. Defaults key_bins(even.steps = FALSE, show.limits = NULL). Changing arguments key_bins() fine, changing key type advised. first_guide, second_guide Guides flank colour steps. guide can specified using one following: class object. returns class object. naming function, without guide_ primitive_ prefix. first_guide placed location specified legend.text.position theme setting. second_guide placed opposite position. second_guide label suppression mechanism, labels drawn guide. shape cap specification providing one following: cap , cap_triangle(). naming cap function without 'cap_'-prefix, e.g. \"round\". two column giving coordinates cap, like created cap functions cap_arch(). size setting size cap. NULL (default), cap size proportional shape coordinates legend.key.size theme setting. show control caps displayed ends bar. TRUE, caps always displayed. FALSE, caps never displayed. NA (default), caps displayed data range exceed limits. given , show[1] controls display lower end show[2] upper end. alpha 0 1 setting colour transparency bar. Use NA preserve alpha encoded colour . reverse whether reverse continuous guides. TRUE, guides like colour bars flipped. FALSE (default), original order maintained. oob --bounds handling function affects cap colour. Can one following: like oob_squish. naming function without 'oob'-prefix, \"keep\". theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\". available_aes vector listing aesthetics guide can build.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_coloursteps_custom.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Custom colour steps guide — guide_coloursteps_custom","text":" object","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_coloursteps_custom.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Custom colour steps guide — guide_coloursteps_custom","text":"steps rendered clipped rectangles, important use graphics device can render clipped paths. can checked using check_device(\"clippingPaths\").","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_coloursteps_custom.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom colour steps guide — guide_coloursteps_custom","text":"","code":"p <- ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = cty)) # The colour steps show caps when values are out-of-bounds p + scale_colour_viridis_b( limits = c(10, NA), guide = \"coloursteps_custom\" ) # It also shows how oob values are handled p + scale_colour_viridis_b( limits = c(10, 30), oob = scales::oob_censor, guide = \"coloursteps_custom\" ) # Adjusting the type of cap p + scale_colour_viridis_b( limits = c(10, 30), guide = guide_coloursteps_custom(shape = \"round\") ) # The default is to use the breaks as-is p + scale_colour_viridis_b( limits = c(10, 30), breaks = c(10, 20, 25), guide = \"coloursteps_custom\" ) # But the display can be set to use evenly spaced steps p + scale_colour_viridis_b( limits = c(10, 30), breaks = c(10, 20, 25), guide = guide_coloursteps_custom(key = key_bins(even.steps = TRUE)) ) # Using tick marks by swapping side guides p + scale_colour_viridis_b( guide = guide_coloursteps_custom( first_guide = \"axis_custom\", second_guide = \"axis_custom\" ) )"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_subtitle.html","id":null,"dir":"Reference","previous_headings":"","what":"Subtitle with coloured phrases — guide_subtitle","title":"Subtitle with coloured phrases — guide_subtitle","text":"guides formats piece text colours determined scale.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_subtitle.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Subtitle with coloured phrases — guide_subtitle","text":"","code":"guide_subtitle(title = waiver(), open = \"{.\", close = \"}\", theme = NULL)"},{"path":"https://teunbrand.github.io/gguidance/reference/guide_subtitle.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Subtitle with coloured phrases — guide_subtitle","text":"title containing text use subtitle. Text formatting discussed details. open, close delimiter indicating colour formatting begins (open) ends (close). theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_subtitle.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Subtitle with coloured phrases — guide_subtitle","text":" object.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_subtitle.html","id":"text-formatting","dir":"Reference","previous_headings":"","what":"Text formatting","title":"Subtitle with coloured phrases — guide_subtitle","text":"Chunks text formatted follows: title chopped pieces split open close delimiters. open delimiter followed integer, integer matched scale's breaks. piece text open delimiter associated close delimiter coloured break's colour. example, title \"{.1 quick} brown {.3 fox} jumps {.2 lazy dog}.\", word \"quick\" given scale's first colour, \"fox\" given third colour \"lazy dog\" given second colour. first space integer index gets trimmed. text inside braces index, scale's labels inserted text. implemented legend guide, takes style options plot.subtitle theme element. true subtitle, might complications guides co-occupy \"top\" legend position.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/guide_subtitle.html","id":"right-to-left-scripts","dir":"Reference","previous_headings":"","what":"Right-to-left scripts","title":"Subtitle with coloured phrases — guide_subtitle","text":"typesetting guide primitive concerns placing text pieces, individual glyphs. consideration given right--left script line converted LtR RtL pieces text line contain characters RtL character sets. Bidirectional text given consideration within function. Glyphs ligatures normal text, separate pieces probably render ligatures. task actually rendering within pieces text, handled graphics device, varying degrees modern text feature support. author function, knows LtR natural languages, profusely apologises inconvenience.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/guide_subtitle.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Subtitle with coloured phrases — guide_subtitle","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy, colour = factor(cyl))) + geom_point() # Typical use case p + scale_colour_discrete( name = \"Cars with {.1 four}, {.2 five}, {.3 six} or {.4 eight} cylinders.\", guide = \"subtitle\" ) # If there is no text in between the delimiters, the scale's `labels` are # substituted. p + scale_colour_discrete( labels = c(\"FOUR\", \"5\", \"Six\", \"foobar\"), name = \"Cars with {.1}, {.2}, {.3} or {.4} cylinders.\", guide = \"subtitle\" ) # Using different text delimiters p + guides(colour = guide_subtitle( \"Cars with <1 four>, <2 five>, <3 six> or <4 eight> cylinders.\", open = \"<\", close = \">\" )) # # For use with {ggtext}, mix html with the open and closing delimiters. # # Leave out the '\\' before quotation marks, it didn't document without # # these backslashes :( # p + # scale_colour_discrete( # name = \\\"Cars with {.1}, {.2 five}<\/b>, {.3} or {.4} cylinders<\/i>.\\\", # guide = \"subtitle\" # ) + # theme(plot.subtitle = ggtext::element_markdown())"},{"path":"https://teunbrand.github.io/gguidance/reference/key_range.html","id":null,"dir":"Reference","previous_headings":"","what":"Range keys — key_range","title":"Range keys — key_range","text":"functions helper functions working ranged data keys guides. share goal creating guide key, different methods: key_range_auto() function factory whose functions make attempt infer ranges scale's labels. key_range_manual() uses user-provided vectors set ranges. key_range_map() makes mappings set ranges.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/key_range.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Range keys — key_range","text":"","code":"key_range_auto(sep = \"[^[:alnum:]]+\", reverse = FALSE) key_range_manual(start, end, name = NULL, level = NULL) key_range_map(data, ..., .call = caller_env())"},{"path":"https://teunbrand.github.io/gguidance/reference/key_range.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Range keys — key_range","text":"sep giving regular expression use splitting labels provided scale using strsplit(). Defaults splitting non-alphanumeric character. reverse FALSE (default) treats first labels inner labels last labels outer labels. TRUE, thee first labels treated outer labels last labels treated inner labels. start, end vector can interpreted scale, giving start end positions range respectively. name list expressions level giving depth range avoid overlaps different ranges. level smaller 1, brackets drawn. data similar object coerced fortify() , mapping argument evaluated. ... set mappings similar provided aes(), evaluated data argument. must contain start end mappings. .call call display messages.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/key_range.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Range keys — key_range","text":"key_range_auto() function. key_range_manual() key_range_map() class.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/key_range.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Range keys — key_range","text":"level variable optional missing, guides use algorithm similar IRanges::disjointBins() avoid overlaps. key_range_auto() work expression labels.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/key_range.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Range keys — key_range","text":"","code":"# Example scale template <- scale_x_discrete(limits = c(\"A 1\", \"B 1\", \"C&1\", \"D&2\", \"E&2\")) # By default, splits on all non-alphanumeric characters auto <- key_range_auto() auto(template) #> start end .label .level #> 1 1 1 A 0 #> 2 2 2 B 0 #> 3 3 3 C 0 #> 4 4 4 D 0 #> 5 5 5 E 0 #> 6 1 3 1 1 #> 7 4 5 2 1 # Only split on a specific character auto <- key_range_auto(sep = \"&\") auto(template) #> Warning: Not all labels in `key_range_auto()` can be split into equal lengths. #> ℹ Is \"&\" the correct `sep` argument? #> start end .label .level #> 1 1 1 A 1 0 #> 2 2 2 B 1 0 #> 3 3 3 C 0 #> 4 4 4 D 0 #> 5 5 5 E 0 #> 6 3 3 1 1 #> 7 4 5 2 1 # Treating the letters as outer labels and numbers as inner labels auto <- key_range_auto(reverse = TRUE) auto(template) #> start end .label .level #> 1 1 1 1 0 #> 2 2 2 1 0 #> 3 3 3 1 0 #> 4 4 4 2 0 #> 5 5 5 2 0 #> 6 1 1 A 1 #> 7 2 2 B 1 #> 8 3 3 C 1 #> 9 4 4 D 1 #> 10 5 5 E 1 # Providing custom values key_range_manual( start = c(1, 5, 10), end = c(4, 15, 11), level = c(0, 2, 1), name = c(\"A\", \"B\", \"C\") ) #> start end .label .level #> 1 1 4 A 0 #> 2 5 15 B 2 #> 3 10 11 C 1 # Values from a key_range_map(presidential, start = start, end = end, name = name) #> start end .label #> 1 1953-01-20 1961-01-20 Eisenhower #> 2 1961-01-20 1963-11-22 Kennedy #> 3 1963-11-22 1969-01-20 Johnson #> 4 1969-01-20 1974-08-09 Nixon #> 5 1974-08-09 1977-01-20 Ford #> 6 1977-01-20 1981-01-20 Carter #> 7 1981-01-20 1989-01-20 Reagan #> 8 1989-01-20 1993-01-20 Bush #> 9 1993-01-20 2001-01-20 Clinton #> 10 2001-01-20 2009-01-20 Bush #> 11 2009-01-20 2017-01-20 Obama #> 12 2017-01-20 2021-01-20 Trump"},{"path":"https://teunbrand.github.io/gguidance/reference/key_specialty.html","id":null,"dir":"Reference","previous_headings":"","what":"Speciality keys — key_specialty","title":"Speciality keys — key_specialty","text":"functions helper functions working keys guides. functions described widely applicable may apply small subset guides. , fine adjust arguments speciality key, swapping types ill-advised. key_sequence() function factory whose functions create regularly spaced sequence limits scale. used colour bar guides. key_bins() function factory whose function create binned key given breaks scale. used colour steps guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/key_specialty.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Speciality keys — key_specialty","text":"","code":"key_sequence(n = 15) key_bins(even.steps = FALSE, show.limits = NULL)"},{"path":"https://teunbrand.github.io/gguidance/reference/key_specialty.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Speciality keys — key_specialty","text":"n positive giving number colours use gradient. even.steps indicating whether size bins displayed equal (TRUE) proportional length data space (FALSE). show.limits stating whether limits scale shown labels ticks (TRUE) remain hidden (FALSE). Note breaks coinciding limits shown regardless setting. default, NULL, consults scale's show.limits setting defaults FALSE.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/key_specialty.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Speciality keys — key_specialty","text":"key_sequence() function.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/key_specialty.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Speciality keys — key_specialty","text":"","code":"# An example scale template <- scale_fill_viridis_c(limits = c(0, 10), breaks = c(2, 4, 6, 8)) # Retrieving colourbar and colourstep keys key_sequence()(template) #> fill .value #> 1 #440154 0.0000000 #> 2 #461F66 0.7142857 #> 3 #453478 1.4285714 #> 4 #414888 2.1428571 #> 5 #3C5B8A 2.8571429 #> 6 #336D8D 3.5714286 #> 7 #2B7F8D 4.2857143 #> 8 #2B9089 5.0000000 #> 9 #26A186 5.7142857 #> 10 #40B17B 6.4285714 #> 11 #5FBF69 7.1428571 #> 12 #76CE56 7.8571429 #> 13 #A4D848 8.5714286 #> 14 #D2E039 9.2857143 #> 15 #FDE725 10.0000000 key_bins()(template) #> fill min max .label .value #> 1 #46286D 0 2 NA #> 2 #3B5E8B 2 4 2 2 #> 3 #2B9089 4 6 4 4 #> 4 #5ABC6D 6 8 6 6 #> 5 #C0DD40 8 10 8 8 #> 6 NA NA NA"},{"path":"https://teunbrand.github.io/gguidance/reference/key_standard.html","id":null,"dir":"Reference","previous_headings":"","what":"Standard keys — key_standard","title":"Standard keys — key_standard","text":"functions helper functions working tick marks keys guides. share goal creating guide key, different outcomes: key_auto() function factory whose functions extract typical key major breaks scale. key_manual() uses user-provided vectors make key. key_map() makes mappings make key. key_minor() function factory whose functions also extract minor break positions minor tick marks. key_log() function factory whose functions place ticks intervals log10 space.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/key_standard.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Standard keys — key_standard","text":"","code":"key_auto() key_manual( aesthetic, value = aesthetic, label = as.character(value), type = NULL ) key_map(data, ..., .call = caller_env()) key_minor() key_log( prescale_base = NULL, negative_small = 0.1, expanded = TRUE, labeller = label_log() )"},{"path":"https://teunbrand.github.io/gguidance/reference/key_standard.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Standard keys — key_standard","text":"aesthetic, value vector values guide represent equivalent breaks argument scales. aesthetic mapped, whereas value . intents purposes, aesthetic value identical. label list expressions use labels. type vector representing one break types: \"major\", \"minor\" \"mini\". NULL (default), breaks treated major breaks. data similar object coerced fortify() , mapping argument evaluated. ... set mappings similar provided aes(), evaluated data argument. must contain aesthetic mapping. .call call display messages. expanded Whether ticks cover range scale expansion (TRUE, default), restricted scale limits (FALSE). labeller receives major breaks returns formatted labels.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/key_standard.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Standard keys — key_standard","text":"key_auto(), key_minor() key_log() function. key_manual() key_map() class.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/key_standard.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Standard keys — key_standard","text":"","code":"# An example scale template <- scale_x_continuous(limits = c(0, 10)) # The auto, minor and log keys operate on scales key_auto()(template) #> x .value .label #> 1 0.0 0.0 0.0 #> 2 2.5 2.5 2.5 #> 3 5.0 5.0 5.0 #> 4 7.5 7.5 7.5 #> 5 10.0 10.0 10.0 key_minor()(template) #> x .value .label .type #> 1 0.00 0.00 0.0 major #> 2 2.50 2.50 2.5 major #> 3 5.00 5.00 5.0 major #> 4 7.50 7.50 7.5 major #> 5 10.00 10.00 10.0 major #> 6 1.25 1.25 minor #> 7 3.75 3.75 minor #> 8 6.25 6.25 minor #> 9 8.75 8.75 minor # So does the log key template <- scale_x_continuous(transform = \"log10\", limits = c(0.1, 10)) key_log()(template) #> x .value .label .type #> 1 -1.00000000 -1.00000000 10^-1 major #> 2 0.00000000 0.00000000 10^0 major #> 3 1.00000000 1.00000000 10^1 major #> 4 -0.30103000 -0.30103000 NULL minor #> 5 0.69897000 0.69897000 NULL minor #> 6 -0.69897000 -0.69897000 NULL mini #> 7 -0.52287875 -0.52287875 NULL mini #> 8 -0.39794001 -0.39794001 NULL mini #> 9 -0.22184875 -0.22184875 NULL mini #> 10 -0.15490196 -0.15490196 NULL mini #> 11 -0.09691001 -0.09691001 NULL mini #> 12 -0.04575749 -0.04575749 NULL mini #> 13 0.30103000 0.30103000 NULL mini #> 14 0.47712125 0.47712125 NULL mini #> 15 0.60205999 0.60205999 NULL mini #> 16 0.77815125 0.77815125 NULL mini #> 17 0.84509804 0.84509804 NULL mini #> 18 0.90308999 0.90308999 NULL mini #> 19 0.95424251 0.95424251 NULL mini # Providing custom values key_manual( aesthetic = 1:5, label = c(\"one\", \"two\", \"three\", \"four\", \"five\") ) #> aesthetic .value .label #> 1 1 1 one #> 2 2 2 two #> 3 3 3 three #> 4 4 4 four #> 5 5 5 five # Values from a `` key_map(ToothGrowth, aesthetic = unique(supp)) #> aesthetic .value .label #> 1 VC VC VC #> 2 OJ OJ OJ"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_box.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitives: boxes — primitive_box","title":"Guide primitives: boxes — primitive_box","text":"function constructs boxes guide primitive.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_box.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitives: boxes — primitive_box","text":"","code":"primitive_box( key = \"range_auto\", angle = waiver(), oob = \"squish\", drop_zero = TRUE, pad_discrete = 0.4, min_size = NULL, theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_box.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitives: boxes — primitive_box","text":"key range key specification. See information linked topic. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. oob method dealing --bounds (oob) ranges. Can one \"squish\", \"censor\" \"none\". drop_zero whether drop near-zero width ranges (TRUE, default) preserve (FALSE). pad_discrete giving amount ranges extended given discrete variable. applied drop_zero setting. min_size theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_box.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitives: boxes — primitive_box","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_box.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitives: boxes — primitive_box","text":"theme options determine styling guide, may differ depending whether guide used axis legend context. Common types following: gguidance.box boxes draw.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_box.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitives: boxes — primitive_box","text":"axis.text.{x/y}.{position} text inside boxes.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_box.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitives: boxes — primitive_box","text":"legend.text text inside boxes.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_box.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitives: boxes — primitive_box","text":"","code":"# A standard plot p <- ggplot(mpg, aes(interaction(drv, year), displ)) + geom_point() key <- key_range_manual(c(2, 4), c(5, 6), c(\"A\", \"B\")) # Adding as secondary guides p + guides( x.sec = primitive_box(), y.sec = primitive_box(key = key) )"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_bracket.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: brackets — primitive_bracket","title":"Guide primitive: brackets — primitive_bracket","text":"function constructs brackets guide primitive.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_bracket.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: brackets — primitive_bracket","text":"","code":"primitive_bracket( key = \"range_auto\", bracket = \"line\", angle = waiver(), oob = \"squish\", drop_zero = TRUE, pad_discrete = 0.4, theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_bracket.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: brackets — primitive_bracket","text":"key range key specification. See information linked topic. bracket bracket providing one following: bracket , bracket_square. naming bracket function without 'bracket_'-prefix, e.g. \"square\". two-column giving line coordinates bracket, like created bracket functions, bracket_round(). angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. oob method dealing --bounds (oob) ranges. Can one \"squish\", \"censor\" \"none\". drop_zero whether drop near-zero width ranges (TRUE, default) preserve (FALSE). pad_discrete giving amount ranges extended given discrete variable. applied drop_zero setting. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_bracket.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: brackets — primitive_bracket","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_bracket.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: brackets — primitive_bracket","text":"theme options determine styling guide, may differ depending whether guide used axis legend context. Common types following: gguidance.bracket line used draw brackets. gguidance.backet.size setting space afforded bracket.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_bracket.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: brackets — primitive_bracket","text":"axis.text.{x/y}.{position} text displayed brackets.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_bracket.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: brackets — primitive_bracket","text":"legend.text text displayed brackets.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_bracket.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: brackets — primitive_bracket","text":"","code":"# A standard plot p <- ggplot(mpg, aes(interaction(drv, year), displ)) + geom_point() key <- key_range_manual(c(2, 4), c(5, 6), c(\"A\", \"B\")) # Adding as secondary guides p + guides( x.sec = primitive_bracket(), y.sec = primitive_bracket(key = key) )"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: labels — primitive_labels","title":"Guide primitive: labels — primitive_labels","text":"function constructs labels guide primitive.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: labels — primitive_labels","text":"","code":"primitive_labels( key = NULL, angle = waiver(), n.dodge = 1, check.overlap = FALSE, theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_labels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: labels — primitive_labels","text":"key standard key specification. See information linked topic. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. n.dodge positive setting number layers text labels can occupy avoid overlapping labels. check.overlap indicating whether check omit overlapping text. TRUE, first, last middle labels recursively prioritised order. FALSE, labels drawn. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_labels.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: labels — primitive_labels","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_labels.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: labels — primitive_labels","text":"theme options determine styling guide, may differ depending whether guide used axis legend context.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_labels.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: labels — primitive_labels","text":"axis.text.{x/y}.{position} display labels.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_labels.html","id":"as-a-legend-guide-","dir":"Reference","previous_headings":"","what":"As a legend guide.","title":"Guide primitive: labels — primitive_labels","text":"legend.text display labels.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_labels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: labels — primitive_labels","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() # Adding as secondary guides p + guides( x.sec = primitive_labels(), y.sec = primitive_labels(n.dodge = 2) )"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_line.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: line — primitive_line","title":"Guide primitive: line — primitive_line","text":"function constructs line guide primitive.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_line.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: line — primitive_line","text":"","code":"primitive_line(key = NULL, cap = \"none\", theme = NULL, position = waiver())"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_line.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: line — primitive_line","text":"key standard key specification. See information linked topic. cap method cap axes. One following: one following: \"none\" perform capping. \"\" cap line ends extreme breaks. \"upper\" cap line upper extreme break. \"lower\" cap line lower extreme break. [1], TRUE equivalent \"\" FALSE equivalent \"none\" options . sorted [2n] even number members. lines drawn every odd-even pair. takes scale's breaks first argument, scale's limits second argument returns [2n] described . theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_line.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: line — primitive_line","text":"PrimitiveLine primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_line.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: line — primitive_line","text":"theme options determine styling guide, may differ depending whether guide used axis legend context.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_line.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: line — primitive_line","text":"axis.line.{x/y}.{position} line style.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_line.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: line — primitive_line","text":"legend.axis.line line style.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_line.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: line — primitive_line","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() + theme(axis.line = element_line()) # Adding as secondary guides p + guides( x.sec = primitive_line(), y.sec = primitive_line(cap = \"both\") )"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_spacer.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: spacer — primitive_spacer","title":"Guide primitive: spacer — primitive_spacer","text":"function constructs spacer guide primitive.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_spacer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: spacer — primitive_spacer","text":"","code":"primitive_spacer( space = NULL, title = waiver(), theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_spacer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: spacer — primitive_spacer","text":"space [][grid::unit()] title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_spacer.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: spacer — primitive_spacer","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_spacer.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: spacer — primitive_spacer","text":"#' theme options determine styling guide. guide option dependent role axis legend. gguidance.guide.spacing setting amount spacing space argument NULL.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_spacer.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: spacer — primitive_spacer","text":"","code":"ggplot(mpg, aes(displ, hwy)) + geom_point() + guides( x = guide_axis_stack(\"axis\", primitive_spacer(unit(1, \"cm\")), \"axis\") )"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_ticks.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: line — primitive_ticks","title":"Guide primitive: line — primitive_ticks","text":"function constructs ticks guide primitive.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_ticks.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: line — primitive_ticks","text":"","code":"primitive_ticks(key = NULL, bidi = FALSE, theme = NULL, position = waiver())"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_ticks.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: line — primitive_ticks","text":"key standard key specification. See information linked topic. bidi : whether ticks drawn bidirectionally (TRUE) single direction (FALSE, default). theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_ticks.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: line — primitive_ticks","text":"PrimitiveTicks primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_ticks.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: line — primitive_ticks","text":"theme options determine styling guide, may differ depending whether guide used axis legend context. Common types following:","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_ticks.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: line — primitive_ticks","text":"axis.ticks.{x/y}.{position} major tick lines. axis.minor.ticks.{x/y}.{position} minor tick lines. gguidance.axis.mini.ticks internally inheriting minor ticks smallest ticks e.g. log axes. axis.ticks.length.{x/y}.{position} major ticks length. axis.minor.ticks.length.{x/y}.{position} minor ticks length. gguidance.axis.mini.ticks.length internally inheriting minor tick length smallest ticks e.g. log axes.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_ticks.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: line — primitive_ticks","text":"legend.ticks major tick lines. gguidance.legend.minor.ticks minor tick lines. gguidance.legend.mini.ticks smallest ticks e.g. log axes. legend.ticks.length major ticks length. gguidance.legend.minor.ticks.length minor ticks length. gguidance.legend.mini.ticks.length smallest ticks e.g. log axes.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_ticks.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: line — primitive_ticks","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() # Adding as secondary guides p + guides(x.sec = primitive_ticks(), y.sec = primitive_ticks())"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_title.html","id":null,"dir":"Reference","previous_headings":"","what":"Guide primitive: title — primitive_title","title":"Guide primitive: title — primitive_title","text":"function constructs title guide primitive.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_title.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guide primitive: title — primitive_title","text":"","code":"primitive_title( title = waiver(), angle = waiver(), theme = NULL, position = waiver() )"},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_title.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guide primitive: title — primitive_title","text":"title indicating title guide. NULL, title shown. default, waiver(), takes name scale object name specified labs() title. angle specification text angle. Compared setting angle argument element_text(), argument uses heuristics automatically pick hjust vjust probably want. Can one following: NULL take angles justification settings directly theme. waiver() allow reasonable defaults special cases. -360 360 text angle degrees. theme object style guide individually differently plot's theme settings. theme argument guide overrides combined plot's theme. position giving location guide. Can one \"top\", \"bottom\", \"left\" \"right\".","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_title.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guide primitive: title — primitive_title","text":" primitive guide can used inside guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_title.html","id":"styling-options","dir":"Reference","previous_headings":"","what":"Styling options","title":"Guide primitive: title — primitive_title","text":"theme options determine styling guide, may differ depending whether guide used axis legend context.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_title.html","id":"as-an-axis-guide","dir":"Reference","previous_headings":"","what":"As an axis guide","title":"Guide primitive: title — primitive_title","text":"axis.title.{x/y}.{position} title display.","code":""},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_title.html","id":"as-a-legend-guide","dir":"Reference","previous_headings":"","what":"As a legend guide","title":"Guide primitive: title — primitive_title","text":"legend.title title display.","code":""},{"path":[]},{"path":"https://teunbrand.github.io/gguidance/reference/primitive_title.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guide primitive: title — primitive_title","text":"","code":"# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() # Adding as secondary guides p + guides( x.sec = primitive_title(\"Horizontal Title\"), y.sec = primitive_title(c(\"along vertical\", \"Multiple tiles\")) )"},{"path":"https://teunbrand.github.io/gguidance/news/index.html","id":"gguidance-development-version","dir":"Changelog","previous_headings":"","what":"gguidance (development version)","title":"gguidance (development version)","text":"Restarted package scratch, using different approach.","code":""},{"path":"https://teunbrand.github.io/gguidance/news/index.html","id":"mechanism-development-version","dir":"Changelog","previous_headings":"","what":"Mechanism","title":"gguidance (development version)","text":"crux gguidance combine ‘key’, contains instructions values represented, ‘guide’ controls values represented.","code":""},{"path":"https://teunbrand.github.io/gguidance/news/index.html","id":"full-guides-development-version","dir":"Changelog","previous_headings":"","what":"Full guides","title":"gguidance (development version)","text":"Full guides guides can just drop guides() function guide argument scales. guide_axis_custom() axis guide. guide_colourbar_custom() colour/fill guide. guide_coloursteps_custom() colour/fill guide. guide_subtitle() colour/fill guide.","code":""},{"path":"https://teunbrand.github.io/gguidance/news/index.html","id":"gizmos-development-version","dir":"Changelog","previous_headings":"","what":"Gizmos","title":"gguidance (development version)","text":"Gizmos standalone specialised displays. gizmo_barcap() displaying colour gradients capping options. gizmo_stepcap() displaying stepped gradients capping options. gizmo_density() displaying gradient-filled densities. gizmo_histogram() displaying gradient-filled histograms. gizmo_grob() displaying custom grobs.","code":""},{"path":"https://teunbrand.github.io/gguidance/news/index.html","id":"compositions-development-version","dir":"Changelog","previous_headings":"","what":"Compositions","title":"gguidance (development version)","text":"Compositions offer ways combine guides. compose_stack() stacking guides. compose_ontop() overlaying guides. compose_crux() layout guides cross. compose_sandwich() flanked guides.","code":""},{"path":"https://teunbrand.github.io/gguidance/news/index.html","id":"primitives-development-version","dir":"Changelog","previous_headings":"","what":"Primitives","title":"gguidance (development version)","text":"Primitives basic elements guides use. primitive_line() lines. primitive_ticks() tick marks. primitive_labels() text labels. primitive_spacer() empty space. primitive_title() text titles. primitive_bracket() labelled brackets. primitive_box() rectangles.","code":""}] diff --git a/sitemap.xml b/sitemap.xml index 0987bf2..9a829d8 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -9,12 +9,6 @@ https://teunbrand.github.io/gguidance/LICENSE.html - - https://teunbrand.github.io/gguidance/articles/axes.html - - - https://teunbrand.github.io/gguidance/articles/index.html - https://teunbrand.github.io/gguidance/authors.html @@ -28,13 +22,22 @@ https://teunbrand.github.io/gguidance/reference/bracket_options.html - https://teunbrand.github.io/gguidance/reference/breaks_between.html + https://teunbrand.github.io/gguidance/reference/cap_options.html + + + https://teunbrand.github.io/gguidance/reference/common_parameters.html + + + https://teunbrand.github.io/gguidance/reference/compose_crux.html - https://teunbrand.github.io/gguidance/reference/coord_guided.html + https://teunbrand.github.io/gguidance/reference/compose_ontop.html - https://teunbrand.github.io/gguidance/reference/elements_text.html + https://teunbrand.github.io/gguidance/reference/compose_sandwich.html + + + https://teunbrand.github.io/gguidance/reference/compose_stack.html https://teunbrand.github.io/gguidance/reference/gguidance-package.html @@ -43,45 +46,72 @@ https://teunbrand.github.io/gguidance/reference/gguidance_extensions.html - https://teunbrand.github.io/gguidance/reference/guide_axis_cap.html + https://teunbrand.github.io/gguidance/reference/gizmo_barcap.html - https://teunbrand.github.io/gguidance/reference/guide_axis_extend.html + https://teunbrand.github.io/gguidance/reference/gizmo_density.html - https://teunbrand.github.io/gguidance/reference/guide_axis_minor.html + https://teunbrand.github.io/gguidance/reference/gizmo_grob.html - https://teunbrand.github.io/gguidance/reference/guide_axis_nested.html + https://teunbrand.github.io/gguidance/reference/gizmo_histogram.html - https://teunbrand.github.io/gguidance/reference/guide_axis_table.html + https://teunbrand.github.io/gguidance/reference/gizmo_stepcap.html - https://teunbrand.github.io/gguidance/reference/guide_colour_histogram.html + https://teunbrand.github.io/gguidance/reference/guide-composition.html - https://teunbrand.github.io/gguidance/reference/guide_colour_violin.html + https://teunbrand.github.io/gguidance/reference/guide-gizmos.html - https://teunbrand.github.io/gguidance/reference/guide_colourbar_cap.html + https://teunbrand.github.io/gguidance/reference/guide-primitives.html - https://teunbrand.github.io/gguidance/reference/guide_grid.html + https://teunbrand.github.io/gguidance/reference/guide_axis_custom.html - https://teunbrand.github.io/gguidance/reference/guide_grid_plus.html + https://teunbrand.github.io/gguidance/reference/guide_colourbar_custom.html - https://teunbrand.github.io/gguidance/reference/guide_grid_zebra.html + https://teunbrand.github.io/gguidance/reference/guide_coloursteps_custom.html - https://teunbrand.github.io/gguidance/reference/guide_legend_cross.html + https://teunbrand.github.io/gguidance/reference/guide_subtitle.html - https://teunbrand.github.io/gguidance/reference/guide_legend_string.html + https://teunbrand.github.io/gguidance/reference/index.html - https://teunbrand.github.io/gguidance/reference/index.html + https://teunbrand.github.io/gguidance/reference/key_range.html + + + https://teunbrand.github.io/gguidance/reference/key_specialty.html + + + https://teunbrand.github.io/gguidance/reference/key_standard.html + + + https://teunbrand.github.io/gguidance/reference/primitive_box.html + + + https://teunbrand.github.io/gguidance/reference/primitive_bracket.html + + + https://teunbrand.github.io/gguidance/reference/primitive_labels.html + + + https://teunbrand.github.io/gguidance/reference/primitive_line.html + + + https://teunbrand.github.io/gguidance/reference/primitive_spacer.html + + + https://teunbrand.github.io/gguidance/reference/primitive_ticks.html + + + https://teunbrand.github.io/gguidance/reference/primitive_title.html