Learn R Programming

creditmodel (version 1.3.0)

plot_line: Plot Line

Description

You can use the plot_bar to produce the barplot.

Usage

plot_line(
  dat,
  x,
  y = NULL,
  x_breaks = NULL,
  y_breaks = NULL,
  cut_bin = "equal_width",
  g_x = 10,
  g_y = 5,
  target = NULL,
  value = NULL,
  type = "total_pct",
  reverse = FALSE,
  string_bins = FALSE,
  pl_theme = plot_theme(legend.position = "right", title_size = 9, legend_size = 7,
    axis_title_size = 8),
  fill_colors = c(love_color(type = "deep"), love_color(type = "light"),
    love_color(type = "shallow"))
)

Arguments

dat

A data.frame with independent variables and target variable.

x

The name of an independent variable.

y

The name of target variable. Default is NULL.

x_breaks

Breaks points of x.

y_breaks

Breaks points of y.

cut_bin

'equal_width' or 'equal_depth' to produce the breaks points.

g_x

Number of initial breakpoints for equal frequency binning of x.

g_y

Number of initial breakpoints for equal frequency binning of y.

target

The name of target variable.

value

The name of the variable to sum. When this parameter is NULL, the default statistics is to sum frequency.

type

Output form of the result of crosstable. Provide these forms:"each_pct_x", "each_pct_y","total_sum","total_pct","total_mean","total_median","total_max","total_min","bad_sum","bad_pct".

reverse

Logical,whether reverse the plot.

string_bins

Whether to process bins of classification variables.

pl_theme

theme of the plot

fill_colors

Colors of line.

Examples

Run this code
# NOT RUN {
plot_line(dat = lendingclub, x = "grade")
plot_line(dat = lendingclub, x = "grade", 
   y = "mort_acc",type = "bad_pct",g_x = 10,g_y = 3, cut_bin = 
 "equal_depth",target = "loan_status")
# }

Run the code above in your browser using DataLab