% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.R
\name{plot.units}
\alias{plot.units}
\alias{make_unit_label}
\title{Plot \code{units} objects}
\usage{
make_unit_label(lab, u, sep = units_options("sep"),
  group = units_options("group"), parse = units_options("parse"))

\method{plot}{units}(x, y, xlab = NULL, ylab = NULL, ...)
}
\arguments{
\item{lab}{length one character; name of the variable to plot}

\item{u}{vector of class \code{units}}

\item{sep}{length two character vector, defaulting to \code{c("~","~")}, with
the white space between unit name and unit symbols, and between subsequent
symbols.}

\item{group}{length two character vector with grouping symbols, e.g.
\code{c("(",")")} for parenthesis, or \code{c("","")} for no group symbols}

\item{parse}{logical; indicates whether a parseable expression should be
returned (typically needed for super scripts), or a simple character string
without special formatting.}

\item{x}{object of class units, to plot along the x axis, or, if y is missing, along the y axis}

\item{y}{object to plot along the y axis, or missing}

\item{xlab}{character; x axis label}

\item{ylab}{character; y axis label}

\item{...}{other parameters, passed on to \link{plot.default}}
}
\description{
Create axis label with appropriate labels.

Plot method for \code{units} objects.
}
\details{
\link{units_options} can be used to set and change the defaults for
  \code{sep}, \code{group} and \code{doParse}.
}
\examples{
displacement = mtcars$disp * as_units("in")^3
units(displacement) = make_units(cm^3)
weight = mtcars$wt * 1000 * make_units(lb)
units(weight) = make_units(kg)
plot(weight, displacement)

units_options(group = c("(", ")") )  # parenthesis instead of square brackets
plot(weight, displacement)

units_options(sep = c("~~~", "~"), group = c("", ""))  # no brackets; extra space
plot(weight, displacement)

units_options(sep = c("~", "~~"), group = c("[", "]"))
gallon = as_units("gallon")
consumption = mtcars$mpg * make_units(mi/gallon)
units(consumption) = make_units(km/l)
plot(displacement, consumption) # division in consumption

units_options(negative_power = TRUE) # division becomes ^-1
plot(displacement, consumption)

plot(1/displacement, 1/consumption)

}
