This function takes a data table, quantitative X and Y variables, and a numeric grouping variable, and a and plots a graph with using geom_point. The numerical NumGroup variable is mapped to the fill aesthetic of symbols, which receives the scale_fill_grafify_c default palette.

plot_xy_NumGroup(
  data,
  xcol,
  ycol,
  NumGroup,
  symsize = 2.5,
  symthick = 1,
  s_alpha = 1,
  TextXAngle = 0,
  fontsize = 20
)

Arguments

data

a data table object, e.g. data.frame or tibble.

xcol

name of the column with quantitative X variable.

ycol

name of the column with quantitative Y variable.

NumGroup

a numeric factor for fill aesthetic of data points.

symsize

size of symbols used by geom_point. Default set to 2.5, increase/decrease as needed.

symthick

thickness of symbol border, default set to 1.

s_alpha

fractional opacity of symbols, default set to 1 (i.e. maximum opacity & zero transparency).

TextXAngle

orientation of text on X-axis; default 0 degrees. Change to 45 or 90 to remove overlapping text.

fontsize

parameter of base_size of fonts in theme_classic, default set to size 20.

Value

This function returns a ggplot2 object of class "gg" and "ggplot".

Details

This plot is related to plot_xy_CatGroup which requires a categorical grouping factor. When summary statistics (mean/median) are required, use plot_3d_scatterbar, plot_3d_scatterbox or plot_4d_scatterbox.

Examples

#The grouping factor gear is numeric 
plot_xy_NumGroup(data = mtcars,
xcol = mpg, ycol = disp, NumGroup = cyl,
s_alpha = 0.8)