Description Usage Arguments Details Value Author(s) References See Also Examples
The function skyline.hist
draws several histograms in one plot. The
resulting image may look like a skyline.
1 2 3 4 5 6 | skyline.hist(x, n.class, n.hist = 1, main, ylab="density",
night = FALSE, col.bars = NA, col.border = 4, lwd.border = 2.5,
n.shading = 6, lwd.shading = 2, col.shading = NA, lty.shading = 3,
pcol.data = "green", cex.data = 0.3, pch.data = 16, col.data = 1,
lwd.data = .2, permutation = FALSE,
xlab, xlim, ylim, new.plot=TRUE, bty="n", ...)
|
x |
one dimensional data set. |
n.class |
number of classes that should be used to find the width of the bars of the histogram(s). |
n.hist |
number of histograms that should be plotted. |
main |
used for call of |
ylab |
text for y axis. |
night |
If |
col.bars |
defines the color of the bars. If |
col.border |
color of the borders of the bars. |
lwd.border |
line width of the borders of the bars. |
n.shading |
number of vertical lines for filling the bars of the histograms. |
lwd.shading |
line width of the vertical lines for shading the bars. |
col.shading |
color for the vertical lines for shading. If |
lty.shading |
line type for the vertical lines for shading. |
pcol.data |
color of data points. |
cex.data |
character size of plotting character. |
pch.data |
plotting character of data points. |
lwd.data |
line width for segments between data points. |
col.data |
color for segments between data points. |
permutation |
if not |
xlab |
text for y axis. |
xlim |
range of x. |
ylim |
range of y. |
new.plot |
logical. If |
bty |
box type, used by |
... |
further graphical parameters passed to plot. |
skyline.hist
computes several histograms and plots them one upon
the other. The histograms differ in the positions of the first cells,
but all cells have the same width. The parameters n.class
and
n.hist
have the greatest effect on the design of the result.
col.border
allows to color the border of the rectangular boxes of the
histogram bars. col.bars
defines the fill color of the bars.
n.shading
defines the number of vertical lines of type
lty.shading
and width lwd.shading
that are drawn within the boxes.
Another feature of skyline.hist
is to represent the data points.
The data points of a cell are plotted according their x-values and
their ranks (within the points of the cell). The resulting points are connected
by line segments and you will see a time series running from bottom to top
in each cell. The points and lines can be specified by pcol.data
,
cex.data
, pch.data
, lwd.data
, col.data
. To get rid
of the original order of the data you can permutated them (permutation=1
).
The "skyline" of the plot may be similar to the skyline of a town and the
vertical lines may look like small windows of buildings.
In Young et. al. you find "shaded histograms". These histograms have triggered
the idea of skyline.hist
and the representation of a one dimensional
data set by laying histograms on top of otheroverlied histograms.
The result of a call of hist is returned.
Peter Wolf, pwolf@wiwi.uni-bielefeld.de
F.W. Young, R.M. Valero-Mora, M. Friendly (2006): Visual Statistics. Wiley, p207–208.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # dev.off()
print(par())
par(mfrow=c(1,1))
for(n.c in c(2,4,8)){ # some values for n.class
for(n.h in c(2,4,3)){# some values for number of n.hist
n.s <- 9 # value for number of vertical lines
skyline.hist(co2, n.shading = n.s, n.hist = n.h ,n.class = n.c,
night = n.h==3, col.border = n.h!=4)
}
}
par(mfrow = c(1,1))
skyline.hist(x=rivers, n.class=4, n.hist=2, n.shading=0, main="rivers",
cex.data=.5, lwd.data = .2, col.data = "green", pcol.data = "red",
col.border=NA, night=FALSE, ylab="density")
skyline.hist(x=rivers, n.class=4, n.hist=5, n.shading=0, main="rivers",
cex.data=.5, lwd.data = 1, col.data = "green", pcol.data = "red",
col.border=NA, night="blue" , ylab="density", col.bars =NA)
skyline.hist(x=rivers, n.class=10, n.hist=2, n.shading=0, main="rivers",
cex.data=.5, lwd.data = 1, col.data = "green", pcol.data = "red",
col.border=NA, night=FALSE , ylab="density", col.bars = "lightblue")
skyline.hist(x=rivers, n.class=10, n.hist=1, n.shading=0, main="rivers",
cex.data=1, lwd.data = 0, col.data = "green", pcol.data = "red",
col.border=NA, night=FALSE , ylab="density", col.bars = "lightblue" )
skyline.hist(x=rivers, n.class=6, n.hist=1, n.shading=0, main="rivers",
cex.data=0.1, lwd.data = 2, col.data = "red", pcol.data = "green",
night="orange" , ylab="density", col.bars = "white", col.border=1 )
skyline.hist(x=rivers, n.class=6, n.hist=1, n.shading=0, main="rivers",
cex.data=0.1, lwd.data = 2, col.data = "red", pcol.data = "green",
col.border=NA, night=FALSE , ylab="density", col.bars = "lightblue")
skyline.hist(x=rivers, n.class=6, n.hist=1, n.shading=5, col.shading = "blue",
main="rivers",
cex.data=0.1, lwd.data = 1, col.data = "black", pcol.data = "green",
col.border=NA, night=FALSE , ylab="density", col.bars = "green")
skyline.hist(x=rivers, n.class=6, n.hist=3, n.shading=5, col.shading = "blue",
main="rivers", col.bars = "green",
cex.data=0.1, lwd.data = 1, col.data = "black", pcol.data = "green",
col.border="white", night="magenta" , ylab="density")
skyline.hist(x=rivers, n.class=6, n.hist=4, n.shading=5, col.shading = "blue",
main="rivers",
cex.data=0.8, lwd.data = 1, col.data = "blue", pcol.data = "red",
col.border=NA, night=FALSE , ylab="density", col.bars = "green")
|
Loading required package: tcltk
Warning message:
no DISPLAY variable so Tk is not available
$xlog
[1] FALSE
$ylog
[1] FALSE
$adj
[1] 0.5
$ann
[1] TRUE
$ask
[1] FALSE
$bg
[1] "white"
$bty
[1] "o"
$cex
[1] 1
$cex.axis
[1] 1
$cex.lab
[1] 1
$cex.main
[1] 1.2
$cex.sub
[1] 1
$cin
[1] 0.15 0.20
$col
[1] "black"
$col.axis
[1] "black"
$col.lab
[1] "black"
$col.main
[1] "black"
$col.sub
[1] "black"
$cra
[1] 10.8 14.4
$crt
[1] 0
$csi
[1] 0.2
$cxy
[1] 0.02764128 0.04143646
$din
[1] 6.666667 6.666667
$err
[1] 0
$family
[1] ""
$fg
[1] "black"
$fig
[1] 0 1 0 1
$fin
[1] 6.666667 6.666667
$font
[1] 1
$font.axis
[1] 1
$font.lab
[1] 1
$font.main
[1] 2
$font.sub
[1] 1
$lab
[1] 5 5 7
$las
[1] 0
$lend
[1] "round"
$lheight
[1] 1
$ljoin
[1] "round"
$lmitre
[1] 10
$lty
[1] "solid"
$lwd
[1] 1
$mai
[1] 1.02 0.82 0.82 0.42
$mar
[1] 5.1 4.1 4.1 2.1
$mex
[1] 1
$mfcol
[1] 1 1
$mfg
[1] 1 1 1 1
$mfrow
[1] 1 1
$mgp
[1] 3 1 0
$mkh
[1] 0.001
$new
[1] FALSE
$oma
[1] 0 0 0 0
$omd
[1] 0 1 0 1
$omi
[1] 0 0 0 0
$page
[1] TRUE
$pch
[1] 1
$pin
[1] 5.426667 4.826667
$plt
[1] 0.123 0.937 0.153 0.877
$ps
[1] 12
$pty
[1] "m"
$smo
[1] 1
$srt
[1] 0
$tck
[1] NA
$tcl
[1] -0.5
$usr
[1] 0 1 0 1
$xaxp
[1] 0 1 5
$xaxs
[1] "r"
$xaxt
[1] "s"
$xpd
[1] FALSE
$yaxp
[1] 0 1 5
$yaxs
[1] "r"
$yaxt
[1] "s"
$ylbias
[1] 0.2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.