papaya
Class CorrelationPlot

java.lang.Object
  extended by papaya.Visuals
      extended by papaya.CorrelationPlot
All Implemented Interfaces:
PapayaConstants

public class CorrelationPlot
extends Visuals

Takes in a matrix and plots the data in each of the columns versus each other. Each of the columns are normalized to their minimum and maximum values which can be a little misleading. For example, say you are looking at columns specifying the weight of different panda bears over 100 days. Panda bear A (Ling-Ling)'s weight varies from 650 to 970 pounds (she's an emotional eater), while panda bear B (Thomas)'s weight varies from 512 to 516 pounds (he's not a big fan of bamboo; also kind of metrosexual). The correlation plot will not show you this difference in magnitudes or ranges! There are many ways of addressing that, and all of them involve you writing your own code. :)

If you absolutely insist on using this despite the warning above, then the (somewhat messy) hack around it is to pad each column of your data with 2 additional rows containing the minimum and maximum that you want to abide by. Just make sure it doesn't muck everything else up though!


Field Summary
 
Fields inherited from class papaya.Visuals
bgColor
 
Fields inherited from interface papaya.PapayaConstants
BASELINE, big, biginv, BOTTOM, CENTER, CORNER, FONTNAME, GRAY, INDEX_NOT_FOUND, INDICES_NOT_FOUND, LEFT, LOGPI, MACHEP, MAXGAM, MAXLOG, MINLOG, RIGHT, SQRTH, SQTPI, STROKEWEIGHT, TEXTSIZE, TOP
 
Constructor Summary
CorrelationPlot(PApplet _theParent, float _plotLeft, float _plotTop, float _plotWidth, float _plotHeight)
          Setup the plot dimensions
 
Method Summary
 void drawBorderAndLabels(String[] categories, int bgColor)
          Draw the bordering lines and write the labels.
 void drawPlot(float[][] data, int pos, int fColor)
          Plots the scatter plot of each of the columns of the input data matrix vs.
 
Methods inherited from class papaya.Visuals
drawAxes, drawRect, drawRect, getBottom, getHeight, getLeft, getRight, getTop, getWidth, horizLine, legendHoriz, legendVert, line, mapXData, mapXData, mapYData, mapYData, setBackgroundColor, setHeight, setLeft, setTop, setupFont, setupFont, setWidth, vertLine, writeLabels, writeLabels, writeLabels, writeLabels, writeLabels, writeTitle, xLabels, xLabels, xTicks, yLabels, yLabels, YLines, yTicks
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CorrelationPlot

public CorrelationPlot(PApplet _theParent,
                       float _plotLeft,
                       float _plotTop,
                       float _plotWidth,
                       float _plotHeight)
Setup the plot dimensions

Method Detail

drawPlot

public void drawPlot(float[][] data,
                     int pos,
                     int fColor)
Plots the scatter plot of each of the columns of the input data matrix vs. the other columns. Each of the columns are normalized to their minimum and maximum values which can be a little misleading. For example, say you are looking at columns specifying the weight of different panda bears over 100 days. Panda bear A (Ling-Ling)'s weight varies from 450 to 670 pounds (she's an emotional eater), while panda bear B (Thomas)'s weight varies from 512 to 516 pounds (he's not a big fan of bamboo). The correlation plot will not show you this difference since both could follow the same sort of distribution. There are many ways of addressing that, and all of them involve you writing your own code. :)

If you absolutely insist on using this despite the warning above, then the (very messy) hack around it is to pad each column of your data with 2 additional rows containing the minimum and maximum that you want to abide by. Just make sure it doesn't muck everything else up though!

Parameters:
data - the data array with each column corresponding to a dataset
pos - 0 for top right plots, 1 for bottom left plots
fColor - the fill color for the dots on the plot.

drawBorderAndLabels

public void drawBorderAndLabels(String[] categories,
                                int bgColor)
Draw the bordering lines and write the labels.

Parameters:
categories - the labels along the diagonal
bgColor - background rectangle color


Processing library papaya by Adila Faruk. (C) 2014