mirror of
https://github.com/ryantimpe/brickr.git
synced 2026-01-06 05:39:34 -06:00
coord_brick()!
This commit is contained in:
@@ -29,6 +29,7 @@ Collate:
|
||||
'bricks_from_data.R'
|
||||
'bricks_to_3d.R'
|
||||
'collect_bricks.R'
|
||||
'coord_brick.R'
|
||||
'geom_brick.R'
|
||||
'geom_brick_col.R'
|
||||
'geom_brick_point.R'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Generated by roxygen2: do not edit by hand
|
||||
|
||||
export("%>%")
|
||||
export(CoordBrick)
|
||||
export(GeomBrick)
|
||||
export(GeomBrickCol)
|
||||
export(bricks_from_coords)
|
||||
@@ -9,6 +10,7 @@ export(bricks_from_table)
|
||||
export(collect_3d)
|
||||
export(collect_bricks)
|
||||
export(convert_to_match_color)
|
||||
export(coord_brick)
|
||||
export(display_3d)
|
||||
export(display_bricks)
|
||||
export(display_colors)
|
||||
|
||||
30
R/coord_brick.R
Normal file
30
R/coord_brick.R
Normal file
@@ -0,0 +1,30 @@
|
||||
#' Cartesian coordinates with fixed "aspect ratio"
|
||||
#'
|
||||
#' A fixed scale coordinate system forces a specified ratio between the
|
||||
#' physical representation of data units on the axes. The ratio represents the
|
||||
#' number of units on the y-axis equivalent to one unit on the x-axis.
|
||||
#'
|
||||
#' @export
|
||||
#' @param ratio aspect ratio, expressed as `y / x`
|
||||
#'
|
||||
#' # Resize the plot to see that the specified aspect ratio is maintained
|
||||
coord_brick <- function(ratio = 1, xlim = NULL, ylim = NULL, expand = TRUE, clip = "on") {
|
||||
ggproto(NULL, CoordBrick,
|
||||
limits = list(x = xlim, y = ylim),
|
||||
ratio = ratio,
|
||||
expand = expand,
|
||||
clip = clip
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
#' @rdname brickr-ggproto
|
||||
#' @export
|
||||
CoordBrick <- ggproto("CoordBrick", CoordCartesian,
|
||||
is_free = function() FALSE,
|
||||
|
||||
aspect = function(self, ranges) {
|
||||
1 * self$ratio
|
||||
}
|
||||
)
|
||||
@@ -1,8 +1,9 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/geom_brick.R, R/geom_brick_col.R,
|
||||
% R/geom_brick_point.R, R/resizing_text_grob.R
|
||||
% Please edit documentation in R/coord_brick.R, R/geom_brick.R,
|
||||
% R/geom_brick_col.R, R/geom_brick_point.R, R/resizing_text_grob.R
|
||||
\docType{data}
|
||||
\name{GeomBrick}
|
||||
\name{CoordBrick}
|
||||
\alias{CoordBrick}
|
||||
\alias{GeomBrick}
|
||||
\alias{GeomBrickCol}
|
||||
\alias{GeomStud}
|
||||
@@ -11,8 +12,10 @@
|
||||
\alias{preDrawDetails.resizingTextGrob}
|
||||
\alias{postDrawDetails.resizingTextGrob}
|
||||
\title{GeomBrick}
|
||||
\format{An object of class \code{GeomStud} (inherits from \code{Geom}, \code{ggproto}, \code{gg}) of length 5.}
|
||||
\format{An object of class \code{CoordBrick} (inherits from \code{CoordCartesian}, \code{Coord}, \code{ggproto}, \code{gg}) of length 3.}
|
||||
\usage{
|
||||
CoordBrick
|
||||
|
||||
GeomStud
|
||||
|
||||
resizingTextGrob(...)
|
||||
|
||||
17
man/coord_brick.Rd
Normal file
17
man/coord_brick.Rd
Normal file
@@ -0,0 +1,17 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/coord_brick.R
|
||||
\name{coord_brick}
|
||||
\alias{coord_brick}
|
||||
\title{Cartesian coordinates with fixed "aspect ratio"}
|
||||
\usage{
|
||||
coord_brick(ratio = 1, xlim = NULL, ylim = NULL, expand = TRUE,
|
||||
clip = "on")
|
||||
}
|
||||
\arguments{
|
||||
\item{ratio}{aspect ratio, expressed as \code{y / x}Resize the plot to see that the specified aspect ratio is maintained}
|
||||
}
|
||||
\description{
|
||||
A fixed scale coordinate system forces a specified ratio between the
|
||||
physical representation of data units on the axes. The ratio represents the
|
||||
number of units on the y-axis equivalent to one unit on the x-axis.
|
||||
}
|
||||
Reference in New Issue
Block a user