| Library: | graphic |
| See also: | contour2 contour3 |
| Quantlet: | contour2D | |
| Description: | Plots a 2D contour plot with colours coding a function value for the points on a grid. |
| Usage: | n/a | |
| Input: | ||
| ACM | (10201 x 3) matrix. The first two columns contain the coordinates of a 101x101 grid on which the function values from the third column must be represented with colour. | |
| HueIni | The initial value of hue, a value between 0 and 360. | |
| HueEnd | The final value of hue, a value between 0 and 360. | |
| Lum | The value of luminance (lightness), between 0 and 1. Note that not all values in the range can be realised depending on the values of saturation. | |
| Sat | The value of saturation, between 0 and 1. Note that not all values in the can be realised depending on the values of luminance. | |
| dir | The direction in which the hue changes. 1 denotes a counterclockwise (i.e. red, green, blue) and -1 a clockwise (i.e. red, blue, green) direction. | |
library("xplore");
library("plot");
library("xclust");
library("graphic");
ATM = read("bankruptcy.dat");
nsteps=100;
origin=#(-0.62, 0.0);
endpoints=#(0.52, 1.5);
steps=(endpoints-origin)/nsteps;
npoints=#(nsteps+1, nsteps+1);
AC=grid(origin,steps,npoints);
V=svm(ATM, AC, 2.0, 1.0);
contour2D(AC~V,0,240,0.46,0.85,1);
Vorig=V;
m=rows(ATM);
AT=ATM[,1:2];
DM=0.5*(ATM[,3]+matrix(m,1));
ColVec=7*DM;
ShapeVec=10*matrix(m,1)-7*DM;
setmaskp(AT, ColVec, ShapeVec, 3);
adddata(di, 1, 1, AT);
z=sort(AC~Vorig,#(1,2,3));
{lt,pt} = contour2(z, 0.0);
setmaskp(pt, 5, 9, 2);
adddata(di, 1, 1, pt);
{lt,pt} = contour2(z, 1.0);
setmaskp(pt, 5, 9, 2);
adddata(di, 1, 1, pt);
{lt,pt} = contour2(z, -1.0);
setmaskp(pt, 5, 9, 2);
adddata(di, 1, 1, pt);
setgopt(di,1,1,"xlabel","Profitability","ylabel","Leverage","title","Scores");
setgopt(di,1,2,"ylabel","Scores");
A two dimensional plot. The background colour corresponds to the score. The warmer the colour, the higher the company default probabilty.