data(MktDATA, package = "UBStats")
# Bivariate bar plots
# - Two discrete variables (factor or vector with few levels)
# Joint counts
distr.plot.xy(CustClass, Children,plot.type = "bars",
freq = "Counts", freq.type = "joint",
data = MktDATA)
# - Two discrete variables (factor or vector with few levels)
# Joint percentages, side-by-side bars
# User-defined colors
distr.plot.xy(Children,CustClass, plot.type = "bars",
bar.type = "beside",
freq = "percent", freq.type = "joint",
color = c("red","gold","green","forestgreen"),
data = MktDATA)
# - One numeric variable classified into intervals
# and one variable measured in classes
# Conditional percentages of x|y
distr.plot.xy(TotPurch, Income, plot.type = "bars",
freq = "percent",freq.type = "x|y",
breaks.x = c(0,5,10,15,20,35),
interval.y = TRUE, data = MktDATA)
# Conditional percentages of y|x
distr.plot.xy(TotPurch, Income, plot.type = "bars",
freq = "percent",freq.type = "y|x",
breaks.x = c(0,5,10,15,20,35),
interval.y = TRUE, data = MktDATA)
# Side-by-side boxplots
# - A continuous variable conditioned to a factor,
# a character, or a classified variable
# The distributions of the numeric variable conditioned
# to the factor (or character) are displayed
distr.plot.xy(x = AOV, y = Education, plot.type = "boxplot",
data = MktDATA)
distr.plot.xy(x = Income.S, y = AOV, plot.type = "boxplot",
interval.x = TRUE, data = MktDATA)
distr.plot.xy(x = Baseline, y = TotPurch, plot.type = "boxplot",
breaks.y = c(0,5,10,15,20,35),
data = MktDATA)
# - Two numerical variables. By default distributions
# of y|x are displayed unless differently
# specified in freq.type
distr.plot.xy(x = NPickUp_Purch, y = NWeb_Purch,
plot.type = "boxplot", data = MktDATA)
distr.plot.xy(x = NPickUp_Purch, y = NWeb_Purch,
plot.type = "boxplot",freq.type = "x|y",
data = MktDATA)
# Scatter plots
# - Two numerical variables: default options
distr.plot.xy(Baseline, TotVal, plot.type = "scatter",
fitline = TRUE, data = MktDATA)
# - Two numerical variables: colors based on discrete var
distr.plot.xy(Baseline, TotVal, plot.type = "scatter",
var.c = Marital_Status,
fitline = TRUE, data = MktDATA)
distr.plot.xy(Baseline, TotVal, plot.type = "scatter",
var.c = Income, interval.c = TRUE,
fitline = TRUE, data = MktDATA)
distr.plot.xy(Baseline, TotVal, plot.type = "scatter",
var.c = TotPurch, breaks.c = 10,
fitline = TRUE, data = MktDATA)
# - Two numerical variables: colors based
# on a continuous numerical variable
distr.plot.xy(Baseline, TotVal, plot.type = "scatter",
var.c = AOV, fitline = TRUE, data = MktDATA)
# - One numerical variable and one factor or character
distr.plot.xy(Baseline, Marital_Status, plot.type = "scatter",
fitline = TRUE, data = MktDATA)
distr.plot.xy(Income.S, Baseline, plot.type = "scatter",
interval.x = TRUE,
fitline = TRUE, data = MktDATA)
# color based on a third variable
distr.plot.xy(TotPurch, TotVal, plot.type = "scatter",
breaks.x = c(0,5,10,15,20,35),
var.c = AOV,
fitline = TRUE, data = MktDATA)
# - Two factors or character vectors: bubble plots
distr.plot.xy(Education, LikeMost, plot.type = "scatter",
data = MktDATA)
# - Two classified variables (i.e. not properly numerical):
# bubble plots, changed color
distr.plot.xy(Income.S, TotPurch, plot.type = "scatter",
interval.x = TRUE,
breaks.y = c(0,5,10,15,20,35),
color = "orchid", data = MktDATA)
# Arguments adj.breaks and use.scientific
# Variable with very wide ranges
LargeC<-MktDATA$AOV*5000000
LargeX<-MktDATA$Baseline*1000000
LargeY<-MktDATA$TotVal*1000000
# - Default: no scientific notation
distr.plot.xy(LargeX, LargeY, plot.type = "scatter",
var.c = LargeC, data = MktDATA)
distr.plot.xy(LargeX, LargeY, plot.type = "scatter",
breaks.x = 10, var.c = LargeC,
data = MktDATA)
# - Scientific notation for axes
distr.plot.xy(LargeX, LargeY, plot.type = "scatter",
breaks.x = 10, var.c = LargeC,
use.scientific = TRUE,
data = MktDATA)
# - Scientific notation for intervals' endpoints
distr.plot.xy(LargeX, LargeY, plot.type = "scatter",
breaks.x = 10, var.c = LargeC,
adj.breaks = FALSE,
data = MktDATA)
# - Scientific notation for intervals endpoints and axes
distr.plot.xy(LargeX, LargeY, plot.type = "scatter",
var.c = LargeC, fitline = TRUE,
adj.breaks = FALSE, use.scientific = TRUE,
data = MktDATA)
distr.plot.xy(LargeX, LargeY, plot.type = "scatter",
breaks.x = 10, var.c = LargeC,
adj.breaks = FALSE, use.scientific = TRUE,
data = MktDATA)
Run the code above in your browser using DataLab