Skip to contents

A Cartesian coordinate system that adds sensible guides to axes in a geom_hourglass() layer. It is added automatically to geom_hourglass(). There is no need to explicitly add it to a ggplot, unless you wish to tweak the coordinate system.

Usage

CoordHourglass

coord_hourglass(
  xlim = NULL,
  ylim = NULL,
  expand = TRUE,
  default = FALSE,
  clip = "on",
  date_labels = "%H:%M",
  layer = NULL,
  ...
)

Format

An object of class CoordHourglass (inherits from CoordCartesian, Coord, ggproto, gg) of length 3.

Arguments

xlim, ylim

Limits for the x and y axes.

expand

If TRUE, the default, adds a small expansion factor to the limits to ensure that data and axes don't overlap. If FALSE, limits are taken exactly from the data or xlim/ylim.

default

Is this the default coordinate system? If FALSE (the default), then replacing this coordinate system with another one creates a message alerting the user that the coordinate system is being replaced. If TRUE, that warning is suppressed.

clip

Should drawing be clipped to the extent of the plot panel? A setting of "on" (the default) means yes, and a setting of "off" means no. In most cases, the default of "on" should not be changed, as setting clip = "off" can cause unexpected results. It allows drawing of data points anywhere on the plot, including in the plot margins. If limits are set via xlim and ylim and some data points fall outside those limits, then those data points may show up in places such as the axes, the legend, the plot title, or the plot margins.

date_labels

Formating string for formatting the time labels on the axis. By default it is "%H:%M".

layer

This argument allows you to pass the hourglass layer to which the coordinate system should be applied. It is used to derive the orientation of the plot. By default it is NULL and an attempt is made to derive the orientation of the plot from its axes scales.

...

Arguments passed as extra params to ggplot2::layer()

Value

Returns a ggproto object inheriting from coord_cartesian().

Author

Pepijn de Vries

Examples

coord_hourglass()
#> <ggproto object: Class CoordHourglass, CoordCartesian, Coord, gg>
#>     aspect: function
#>     backtransform_range: function
#>     clip: on
#>     default: FALSE
#>     distance: function
#>     expand: TRUE
#>     extra_params: date_labels geom
#>     is_free: function
#>     is_linear: function
#>     labels: function
#>     limits: list
#>     modify_scales: function
#>     params: list
#>     range: function
#>     render_axis_h: function
#>     render_axis_v: function
#>     render_bg: function
#>     render_fg: function
#>     setup_data: function
#>     setup_layout: function
#>     setup_panel_guides: function
#>     setup_panel_params: function
#>     setup_params: function
#>     train_panel_guides: function
#>     transform: function
#>     super:  <ggproto object: Class CoordHourglass, CoordCartesian, Coord, gg>