APTSIZE | R Documentation |
Size of apartments in Mendebaldea, Spain, and San Jorge, Spain
APTSIZE
A data frame with 15 observations on the following two variables:
size
(apartment size in square meters)
location
(factor
with two levels SanJorge
and Mendebaldea
)
Ugarte, M. D., Militino, A. F., and Arnholt, A. T. 2015. Probability and Statistics with R, Second Edition. Chapman & Hall / CRC.
p <- ggplot(data = APTSIZE, aes(x = location, y = size, fill = location)) + labs(x = "", y = "Apartment size (square meters)") + scale_x_discrete(breaks = c("Mendebaldea", "SanJorge"), labels =c("Mendebaldea", "San Jorge")) + scale_fill_brewer() p + geom_boxplot() # remove the legend p + geom_boxplot() + guides(fill = "none") # violin plot p + geom_violin(scale = 'area') + guides(fill = "none") p + geom_violin(scale = 'count') + guides(fill = "none") p + geom_violin() + geom_boxplot(width = 0.15, fill = 'black') + guides(fill = "none") + stat_summary(fun = median, geom = "point", fill = "white", shape = 23, size = 3) # dotplot p + geom_dotplot(binaxis = "y", stackdir = "center", binwidth = 3) + guides(fill = "none") p + geom_boxplot(width = 0.4) + geom_dotplot(binaxis = "y", stackdir = "center", binwidth = 3) + guides(fill = "none") + scale_fill_brewer(type = "qual", palette = 1) # base graphics boxplot(size ~ location, data = APTSIZE, col = c("red", "yellow"), ylab = "Apartment size (square meters)")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.