Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

superbarplot

super segmented barplot


Description

Plot a barplot, with bars nested and ranging from a max to a minimum value. A similar graphic is used on the weather page of the New York Times.

Usage

superbarplot(x, names = 1:dim(x)[2], names_height = NULL,
  col = gray(seq(0.8, 0.5, length = dim(x)[1]/2)), ...
)

Arguments

x

A matrix with each pair of rows representing a min and max for the bar.

names

Place a name in each bar.

names_height

Where the names should go

col

What colors to use for the bars. There should be half as many specified as rows of x

...

passed to plot.window.

Details

A similar graphic on the weather page of the New York Times shows bars for record highs and lows, normal highs and lows and actual (or predicted) highs or lows for 10 days of weather. This graphic succintly and elegantly displays a wealth of information. Intended as an illustration of the polygon function.

Value

Returns a plot, but no other values.

Author(s)

John Verzani

References

The weather page of the New York Times

See Also

Examples

record.high=c(95,95,93,96,98,96,97,96,95,97)
record.low= c(49,47,48,51,49,48,52,51,49,52)
normal.high=c(78,78,78,79,79,79,79,80,80,80)
normal.low= c(62,62,62,63,63,63,64,64,64,64)
actual.high=c(80,78,80,68,83,83,73,75,77,81)
actual.low =c(62,65,66,58,69,63,59,58,59,60)
x=rbind(record.low,record.high,normal.low,normal.high,actual.low,actual.high)
the.names=c("S","M","T","W","T","F","S")[c(3:7,1:5)]
superbarplot(x,names=the.names)

UsingR

Data Sets, Etc. for the Text "Using R for Introductory Statistics", Second Edition

v2.0-6
GPL (>= 2)
Authors
John Verzani <verzani@math.csi.cuny.edu>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.