papaya
Class SubPlot

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

public class SubPlot
extends Visuals

Convenient class for drawing multiple scatter plots.

Author:
Adila Faruk

Field Summary
 float bottomBound
          Specifies the space on the bottom, between the plot area and the bounding rectangle.
 boolean drawAxes
          Specifies whether to draw the axes
 boolean drawRectangle
          Specifies whether to draw the bounding rectangle around the plot.
 float leftBound
          Specifies the space on the left between the plot area, and the bounding rectangle.
 float rightBound
          Specifies the space on the right betweent the plot area, and the bounding rectangle.
 ScatterPlot[][] s
           
 float topBound
          Specifies the space on the top, between the plot area and the bounding rectangle.
 float[][] xLefts
           
 float xSpacing
           
 float xW
           
 float yH
           
 float ySpacing
           
 float[][] yTops
           
 
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
SubPlot(PApplet theParent, float xLeft, float yTop, float xWidth, float yHeight, int numX, int numY)
          Creates numX*numY plots, each of with xWidth, and height yHeight.
 
Method Summary
 void drawScatterPlot(float[] xDat, float[] yDat, int fColor, int xnum, int ynum)
          Draws the scatterplot for subplot(xnum,ynum) by calling ScatterPlot.drawScatterPlot(float[], float[], float, int).
 void legendHoriz(String where, int[] colors, String[] labels)
          Draws a legend going to the right with the first element situated at (x,y).
 void legendVert(float x, float y, int[] colors, String[] labels)
          Draws a legend going downwards with the first element situated at (x,y).
 void setDataExtremes(float minXDat, float maxXDat, float minYDat, float maxYDat, int xnum, int ynum)
          Sets the data extremes for subplot(xnum,ynum) by calling ScatterPlot.setDataExtremes(float, float, float, float)
 void writeTitle(PFont pFont, String title, int xnum, int ynum)
          Writes the title for subplot(xnum,ynum).
 void writeTitle(String title, int xnum, int ynum)
          Writes the title for subplot(xnum,ynum).
 void xLabels(int _numDiv, int xnum, int ynum)
          Writes the x labels for subplot(xnum,ynum).
 void yLabels(int _numDiv, int xnum, int ynum)
          Writes the y labels for subplot(xnum,ynum).
 
Methods inherited from class papaya.Visuals
drawAxes, drawRect, drawRect, getBottom, getHeight, getLeft, getRight, getTop, getWidth, horizLine, legendHoriz, 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
 

Field Detail

drawRectangle

public boolean drawRectangle
Specifies whether to draw the bounding rectangle around the plot.


drawAxes

public boolean drawAxes
Specifies whether to draw the axes


leftBound

public float leftBound
Specifies the space on the left between the plot area, and the bounding rectangle. That is, the left-most point of the rectangle is given by plotLeft-leftBound.


rightBound

public float rightBound
Specifies the space on the right betweent the plot area, and the bounding rectangle. That is, the right-most point of the rectangle is given by plotLeft+plotWidth+rightBound.


topBound

public float topBound
Specifies the space on the top, between the plot area and the bounding rectangle. That is, the top-most point of the rectangle is given by plotTop - topBound.


bottomBound

public float bottomBound
Specifies the space on the bottom, between the plot area and the bounding rectangle. That is, the bottom-most point of the rectangle is given by plotTop + plotHeight + bottomBound.


xLefts

public float[][] xLefts

yTops

public float[][] yTops

xW

public float xW

yH

public float yH

ySpacing

public float ySpacing

xSpacing

public float xSpacing

s

public ScatterPlot[][] s
Constructor Detail

SubPlot

public SubPlot(PApplet theParent,
               float xLeft,
               float yTop,
               float xWidth,
               float yHeight,
               int numX,
               int numY)
Creates numX*numY plots, each of with xWidth, and height yHeight. subplot(1,1) has its top left corner situated at xLeft, yTop. subplot(1,2) has its top left corner situated at xLeft, yTop + yHeight + yInterval. ... ... subplot(1,numY) has its top left corner situated at xLeft, yTop + (numY-1)*(yHeight+ySpacing)

Method Detail

setDataExtremes

public void setDataExtremes(float minXDat,
                            float maxXDat,
                            float minYDat,
                            float maxYDat,
                            int xnum,
                            int ynum)
Sets the data extremes for subplot(xnum,ynum) by calling ScatterPlot.setDataExtremes(float, float, float, float)


drawScatterPlot

public void drawScatterPlot(float[] xDat,
                            float[] yDat,
                            int fColor,
                            int xnum,
                            int ynum)
Draws the scatterplot for subplot(xnum,ynum) by calling ScatterPlot.drawScatterPlot(float[], float[], float, int). For more control, use s[xnum][ynum].drawScatterPlot directly.


writeTitle

public void writeTitle(PFont pFont,
                       String title,
                       int xnum,
                       int ynum)
Writes the title for subplot(xnum,ynum). For more control over the placement, color, size, I highly recommend you do this yourself. :)


writeTitle

public void writeTitle(String title,
                       int xnum,
                       int ynum)
Writes the title for subplot(xnum,ynum). For more control over the placement, color, size, I highly recommend you do this yourself. :)


legendVert

public void legendVert(float x,
                       float y,
                       int[] colors,
                       String[] labels)
Draws a legend going downwards with the first element situated at (x,y). 100% similar to Visuals.legendVert(float, float, int[], java.lang.String[]).

Overrides:
legendVert in class Visuals
Parameters:
colors - the legend colors
labels - labels that go with each color

legendHoriz

public void legendHoriz(String where,
                        int[] colors,
                        String[] labels)
Draws a legend going to the right with the first element situated at (x,y). Useful for situations where you are plotting more than one dataset.

Parameters:
where - "top" if you want to place the legend at the top, otherwise, it will default to placing it at the bottom of the plots.
colors - the legend colors
labels - labels that go with each color

yLabels

public void yLabels(int _numDiv,
                    int xnum,
                    int ynum)
Writes the y labels for subplot(xnum,ynum). For more control, call the underlying scatterplot directly using s[xnum][ynum].yLabels.


xLabels

public void xLabels(int _numDiv,
                    int xnum,
                    int ynum)
Writes the x labels for subplot(xnum,ynum). For more control, call the underlying scatterplot directly using s[xnum][ynum].xLabels.



Processing library papaya by Adila Faruk. (C) 2014