plot-methods {acs}R Documentation

acs Methods for Function plot


Plot acs objects, with both estimates and confidence intervals.


## S4 method for signature 'acs'
plot(x, conf.level=.95, err.col="red", err.lwd=1,
err.pch="-", err.cex=2, err.lty=2, x.res=300, labels="auto",
by="geography", true.min=T, ...)



the acs object to be plotted


the desired confidence interval to use for error bars; numeric between 0<1


the color to use for the error bars; analogous to graphic parameter col


the line weight to use for the error bars; analogous to graphic parameter lwd


the point character to use for the error bars; analogous to graphic parameter pch


the scaling factor to use for the error bars; analogous to graphic parameter cex


the line type to use for the error bars; analogous to graphic parameter lty


when plot called with a single acs value (see below), x.res determines the resolution of the resulting density plot; integer (defaults to 300, i.e., the curve is drawn with 300 points)


the labels to use for the x axis; defaults to either geography names or acs.colnames based on dimensions of object plotted; vector of proper length required


in cases where multiple rows and columns are plotted, whether to provide a different plot for each value of geography (the default) or acs.colnames; accepts either "geography" or "acs.colnames"


whether to limit the lower bound of a confidence interval to some value or now; TRUE (the default) allows for negative lower bounds; also accepts FALSE to limit lower bounds to 0, or any number, to use that as a minimum lower bound; see details.


provided to allow for passing of additional arguments to plot functions


signature(object = "acs")

When passed an acs object (possibly involving subsetting), plot will call a plot showing both estimates and confidence intervals for the data contained in the object.

If the object contains only one row or only one column, plot will use this dimension as the y-axis and will plot each observation along the x-axis, as three points (an estimate bracketed by upper and lower confidence bounds). If the object contains multiple rows and columns, plot will return a 1-by-y "plot of plots": by default there will be one plot per row showing all the data for each geography, although this can be changed by specifying by="acs.colnames", to plot each variable as its own plot, with all of the geographies along the x-axis.

In the special case where the dimensions of the object are exactly c(1,1) (i.e., a single geography and column), plot will return a density plot of the estimate. In this case, conf.level, err.col, err.lty, and err.lwd will be used to determine the properties of the margins of error lines. (For none, use conf.level=F. For these density plots, users may also wish to set xlim and x.res, which specify the horizontal extent and resolution of the plot.)

plot accepts many of the standard graphical arguments to plot, such as main, sub, xlab, pch, and col, as well new ones listed above.

In some cases, the lower bound of a confidence interval may extend below 0; in some cases this is desired, especially when a variable is actually stating the difference between two estimates. In other cases, this may seem confusing (for example, when reporting the estimated count in a particular category). Setting true.min to FALSE (or 0) will limit the lower boundary of any confidence intervals computed and plotted.


# load ACS data

# plot a single value

# plot by geography

# plot by columns

# a density plot for a single variable

# same, using some graphical parameters
plot(kansas07[7,10], col="blue", err.col="purple", err.lty=3)

plot(kansas07[7,49], col="lightblue", type="h", x.res=3000,
err.col="purple", err.lty=3, err.lwd=4, conf.level=.99,
main=(paste("Distribution of Females>85 Years in ",
geography(kansas07)[7,1], sep="")),
sub="(99-percent margin of error shown in purple)")

# something more complicated...

plot(kansas07[c(1,3,4),3:25], err.col="purple",
pch=16, err.pch="x", err.cex=1, ylim=c(0,5000),
col=rainbow(23), conf.level=.99,
labels=paste("grp. ",1:23))

[Package acs version 2.1.4 Index]