data(MktDATA, package = "UBStats")
# Pie charts
# - A character variable: grey scale
distr.plot.x(x = LikeMost, plot.type = "pie", bw = TRUE, data = MktDATA)
# - A discrete numeric variable: user-defined palette
distr.plot.x(x = Children, plot.type = "pie",
color=c("red","gold","green","forestgreen"),
data = MktDATA)
# Bar charts
# - A factor: standard order of levels
distr.plot.x(x = Education, plot.type = "bars",
freq = "percentage", data = MktDATA)
# - A factor: levels arranged by decreasing percentage
distr.plot.x(x = Education, plot.type = "bars",
freq = "perc", ord.freq = "dec", data = MktDATA)
# - A discrete variable (note: distance between values
# not taken into account)
distr.plot.x(x = NPickUp_Purch, plot.type = "bars",
freq = "percentage", data = MktDATA)
# Spike plots
# - A discrete variable
distr.plot.x(x = NPickUp_Purch, plot.type = "spike",
freq = "percent", data = MktDATA)
# - A factor (levels placed at the same distance)
distr.plot.x(x = Education, plot.type = "spike",
freq = "prop",data = MktDATA)
# - A variable measured in classes (levels placed at the
# same distance)
distr.plot.x(x = Income.S, interval = TRUE,
plot.type = "spike",
freq = "prop",data = MktDATA)
# - A numeric variable classified into intervals
# (levels placed at the same distance)
distr.plot.x(x = AOV, breaks = 5, plot.type = "spike",
data = MktDATA)
# Cumulative distribution plots
# - A discrete variable
distr.plot.x(x = Children, plot.type = "cum", data = MktDATA)
# - A continuous numerical variable
distr.plot.x(x = AOV, plot.type = "cum",
freq = "perc", data = MktDATA)
# - A numeric variable classified into intervals
distr.plot.x(AOV, plot.type = "cum",
breaks = c(0,20,40,60,80,100,180), data = MktDATA)
# - A variable measured in classes
distr.plot.x(Income, plot.type = "cum", interval = TRUE,
freq = "percent", data = MktDATA)
# - A factor
distr.plot.x(x = Education, plot.type = "cum",
freq = "prop",data = MktDATA)
# Histograms
# - A continuous numerical variable: no breaks provided
# default classes built by R
distr.plot.x(x = AOV, plot.type = "histogram", data = MktDATA)
# - A continuous numerical variable: equal width intervals
distr.plot.x(x = AOV, plot.type = "histogram",
breaks = 10, data = MktDATA)
# - A continuous numerical variable: specified breaks
distr.plot.x(AOV, plot.type = "histogram",
breaks = c(0,20,40,60,80,100,180),
data = MktDATA)
# - A variable measured in classes
distr.plot.x(Income, plot.type = "histogram",
interval = TRUE, data = MktDATA)
# Density plots
# - A numerical variable
distr.plot.x(x = AOV, plot.type = "density", data = MktDATA)
# - A numerical variable: breaks are ignored
distr.plot.x(AOV, plot.type = "density",
breaks = c(0,20,40,60,80,100,180),
data = MktDATA)
# - A variable measured in classes
distr.plot.x(Income, plot.type = "density",
interval = TRUE, data = MktDATA)
# Boxplots (only for numerical unclassified variables)
# - A numerical variable
distr.plot.x(x = TotVal, plot.type = "boxplot", data = MktDATA)
# - A numerical variable: with specified breaks
# the plot is not built
# distr.plot.x(AOV, plot.type = "boxplot",
# breaks = c(0,20,40,60,80,100,180),
# data = MktDATA)
# Arguments adj.breaks, use.scientific
# A variable with a very wide range (very small densities)
LargeX<-MktDATA$AOV*5000000
# - Default formatting for intervals' endpoints
distr.plot.x(LargeX, breaks = 5, plot.type = "spike")
# - Scientific notation for intervals' endpoints
distr.plot.x(LargeX, breaks = 5,plot.type = "spike",
adj.breaks = FALSE)
# - Default formatting for axes
distr.plot.x(LargeX, breaks = 5,plot.type = "histogram",
freq = "densities")
# - Scientific notation for axes
distr.plot.x(LargeX, breaks = 5,plot.type = "histogram",
freq = "densities",use.scientific = TRUE)
Run the code above in your browser using DataLab