Description Usage Arguments Details References See Also Examples
S3 method for class mhist
1 2 3 4 5 6 7 8 9 10 | ## S3 method for class 'mhist'
plot(x, beside = TRUE, labels = NULL, colors = NULL,
main = NULL, sub = NULL, ylab = NULL, xlab = NULL, xticks = NULL,
xlabels = NULL, vlinePos = NULL, x.las = 1, xticks.type = c("pretty",
"original"), xlim = NULL, ylim = NULL, type = NULL, font.type = 1,
font.family = c("sans", "serif", "mono"), cex.main = 1.75,
cex.sub = cex.main * 0.9, cex.lab = 1.25, cex.tickmark = 0.75,
cex.legend = 1.5, tcl = -0.25, omi = c(0.5, 0.5, 1, 0.25), mar = c(4,
1, 0, 1), mgp = c(0, 0.5, 0), bin.unit = 0.8, legend.lab = labels,
legend.pos = c("topright", "top", "topleft"), ...)
|
x |
a numeric matrix or data frame, representing distributions by rows (bins by columns); or a list of numeric vectors as distributions. |
beside |
logical, whether plot histograms side-by-side. |
labels |
a string vector of labels for the histograms in |
colors |
the colors for the histograms; by default they are set to colors generated from palette Dark2. Colors will be recycled if the size is smaller than the number of the histograms. |
main |
an overall title for the plot. See |
sub |
a subtitle for the plot, describing the distance and/or alignment gap (the "shift"). |
ylab |
a title for the y axis. See |
xlab |
a title for the x axis. See |
xticks |
a string vector indicating the tickmark labels at x-axis. Defult: NULL. |
xlabels |
character, labels at x-axis. |
vlinePos |
numeric, posiitons for vertical lines. |
x.las |
numeric in 0,1,2,3; the style of axis labels.
See option |
xticks.type |
stinrg in "pretty","original", whether plot the |
xlim |
range of x values, as in |
ylim |
range of y values, as in |
type |
type of plot, as in |
font.type |
the name of a font type for drawing text. See |
font.family |
the name of a font family for drawing text. See |
cex.main |
a numerical value giving the amount by which |
cex.sub |
a numerical value giving the amount by which |
cex.lab |
a numerical value giving the amount by which |
cex.tickmark |
a numerical value giving the amount by which tickmarks should be magnified relative to the default. |
cex.legend |
a numerical value giving the amount by which legends should be magnified relative to the default. |
tcl |
the length of tick marks as a fraction of the height of a line of text.
See option |
omi |
a vector of the form 'c(bottom, left, top, right)' giving the size of the outer margins in inches.
See option |
mar |
a numerical vector of the form |
mgp |
the margin line (in 'mex' units) for the axis title, axis labels and axis line.
See option |
bin.unit |
numeric, indicating the width of a group of bar(s) in unit of x axis. |
legend.lab |
legend labels, a string vector of the same length of distributions in |
legend.pos |
string, a keyword to be used to position the legend.
See |
... |
arguments to be passed to method |
Given a list, matrix or data.frame of histograms, plot multiple histograms side-by-side or as subplots.
See help(GMD)
mhist
mhist.summary
plot.mhist.summary
plot.gmdp
plot.gmdm
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 | ## load library
require("GMD")
## create two normally-distributed samples
## with unequal means and unequal variances
set.seed(2012)
v1 <- rnorm(1000,mean=-5, sd=10)
v2 <- rnorm(1000,mean=10, sd=5)
## create common bins
n <- 20 # desired number of bins
breaks <- gbreaks(c(v1,v2),n) # bin boundaries
x <-
list(ghist(v1,breaks=breaks,digits=0),
ghist(v2,breaks=breaks,digits=0))
mhist.obj <- as.mhist(x)
## plot histograms side-by-side
plot(mhist.obj,mar=c(1.5,1,1,0),
main="Histograms of simulated normal distributions")
## plot histograms as subplots,
## with corresponding bins aligned
plot(mhist.obj,beside=FALSE,mar=c(1.5,1,1,0),
main="Histograms of simulated normal distributions")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.