ez.hist | R Documentation |
plot continous data
ez.hist(
x,
cmd,
bins = 60,
density = FALSE,
xline = NULL,
color = "color",
colors = ez.palette("Zhu"),
alpha = 0.5,
ylab = NULL,
xlab = NULL,
zlab = NULL,
legend.position = "top",
legend.direction = "horizontal",
legend.box = T,
legend.size = c(0, 10),
xangle = 0,
vjust = NULL,
hjust = NULL,
facet = "cols",
theme.apa = TRUE,
...
)
x |
df or vector, if vector cmd ignored |
cmd |
like "x, x|z, x|z a" where x z a are all discrete |
bins |
number of bins (alternatively pass bidwidth that depends on the scale of variable) |
density |
when true ignore bins, plot density (sort of smoothed histogram); when false plot normal histogram |
xline |
draw red line(s) on x axis, eg, 2.5 or c(2.5,4). NULL=mean(df[[xx]]) |
color |
"bw" or "color" black/white or colorblind-friendly color |
alpha |
bar alpha value |
ylab |
y label NULL |
xlab |
x label NULL |
zlab |
z/a/fill/legend label, only applicable when there is z provided NULL |
legend.position |
legend position 'top', 'bottom', 'left', 'right', 'none', c(x,y,two-element numeric vector)
|
legend.direction |
horizontal or vertical |
legend.box |
box of legend, T or F |
legend.size |
c(0,10) the first number 0 controls the legend title, 0=hide; the second number controls legend.key.size, legend.text |
xangle |
angle of x text 0 |
vjust |
vjust of x text NULL |
hjust |
hjust of x text NULL |
facet |
one of 'cols', 'rows', 'wrap' |
print.cmd |
T/F |
a ggplot object (+theme_apa() to get apa format plot), +scale_y_continuous(limits=c(-5,8),breaks=seq(-5,8,by=2),oob=scales::rescale_none)
see http://stackoverflow.com/a/31437048/2292993 for discussion
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.