Description Usage Arguments Author(s) See Also Examples
This function redefines the plot.histogram
function
in the R base package by adding the two arguments width
and
offset
. The function is modified in such a way that it is
backward compatible, i.e. if you do not use the arguments width
and offset
the plot will look the same as the plot generated by
the original function. Note that plot.histogram
is called by
hist
.
1 2 3 4 5 |
x |
a ‘histogram’ object, or a |
freq |
|
density |
the density of shading lines, in lines per inch.
If |
angle |
the slope of shading lines, given as an angle in degrees (counter-clockwise). |
col |
a colour to be used to fill the bars. The default of
|
border |
the color of the border around the bars. |
width |
The relative width of each bar compared to the full width.
|
offset |
The relative horisontal offset of each bar compared to the
full width. A value of |
lty |
the line type used for the bars, see also |
xlim, ylim |
the range of x and y values with sensible defaults. |
main, sub, xlab, ylab |
these arguments to |
axes |
logical, indicating if axes should be drawn. |
labels |
logical or character. Additionally draw labels on top of
bars, if not |
add |
logical. If |
... |
further graphical parameters to |
Modified by Henrik Bengtsson (http://www.braju.com/R/), from the original R plot.histogram.
See also original plot.histogram
.
1 2 3 4 5 6 7 | x1 <- rnorm(1000, 0.4, 0.8)
x2 <- rnorm(1000, 0.0, 1.0)
x3 <- rnorm(1000, -1.0, 1.0)
hist(x1, width=0.33, offset=0.00, col="blue", xlim=c(-4,4),
main="Histogram of x1, x2 & x3", xlab="x1 - blue, x2 - red, x3 - green")
hist(x2, width=0.33, offset=0.33, col="red", add=TRUE)
hist(x3, width=0.33, offset=0.66, col="green", add=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.