View outlier scatter plot

Here we create and display a scatter plot of the first and second principal components,

fig = gcf()

One might wonder what the fig = gcf() in the above code fragment is for or perhaps why in the following fragments there is a fig.clf() before each plot command. Matplotlib when using the Matlab style commands likes to create a new figure for each plot; however when it tries to show a new plot after the previous one has been closed the interpreter fails to actually render the new plot.

What these commands are doing is that first "fig = gcf() saves a reference to the current figure, and then after we're done with the first plot, clears it to make it ready for the next plot command. Alternatively one can ignore all of the gcf and clf code and just only call show once, after one has created all of the plots.

Additionally Matplotlib does have several examples of how to make matplotlib safer for interactive use.

Brandon King 2005-07-29