%% Plot a Histogram for Bin Information Using Name-Value Pair Arguments
% Create a creditscorecard object using the CreditCardData.mat file to load the data (using a dataset from Refaat 2011).

load CreditCardData 
sc = creditscorecard(data);

%
% Perform automatic binning for the PredictorName input argument for CustIncome using the defaults for the algorithm Monotone.

sc = autobinning(sc, 'CustIncome')

%
% Use bininfo to display the autobinned data.

[bi, cp] = bininfo(sc, 'CustIncome')

%
% Plot the bin information for CustIncome without the Weight of Evidence (WOE) line and without a legend by setting the 'WOE' and 'Legend' name-value arguments to 'Off'. Also, set the 'BinText' name-value pair argument to 'PercentRows' to show as text over the plot bars for the proportion of "Good" and "Bad" within each bin, that is, the probability of "Good" and "Bad" within each bin.

plotbins(sc,'CustIncome','WOE','Off','Legend','Off','BinText','PercentRows')
xtickangle(30)

%
%
% Copyright 2015 The MathWorks, Inc.