Description Usage Arguments Author(s) Examples
View source: R/create.histogram.R
Create a histogram using the ggplot2 framework.
1 |
data |
data frame containing the data |
x |
data frame column name to use in histogram, must be passed as a string |
xlab |
label for the x-axis |
ylab |
label for the y-axis |
binwidth |
unit width for binning |
group |
Dataframe element to use to group bars using facet_grid() |
group.col |
Boolean to group data for facet_grid() by column |
group.row |
Boolean to group data for facet_grid() by row |
filename |
filename to save plot to, if none is provided, plot goes to STDOUT |
resolution |
the resolution of the plot to be passed to write.plot |
width |
plot width |
height |
plot height |
theme |
a ggplot2 theme |
Richard de Borja <richard.deborja@sickkids.ca>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # create a simple histogram
create.histogram(
data = mtcars,
x = 'hp',
binwidth = 50
)
# add custom X and Y axis labels
create.histogram(
data = mtcars,
x = 'gear',
binwidth = 1,
xlab = 'Number of Gears',
ylab = 'Frequency'
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.