Graphics Reference
In-Depth Information
PlotModel
classthatiscomposedofseveral
SingleBoxPlotModel
objects.
Scatterplot matrices and parallel coordinate plots are implemented using this class.
he
MultiPlotModel
classdefinesasimplematrixwhoseelementsaregraph-
ics. It has a
setRowColumn(row, column)
method to specify the numbers
of rows and columns. he window defined by a
MultiPlotModel
object is di-
vided into
row
column
small components of the same size. Graphics are placed
on each component by the
setPlotModel(model, row, column)
method
in
MultiPlotModel
,where
model
specifiesa
PlotModel
object, and
row
and
column
specifythelocationofthecomponent.Itispossibletooverlayseveralgraph-
ics on the same component. However, mouse operations are effective only for the
graphics overlaid last.
Our scatterplot matrix is realized by placing scatterplots on off-diagonal com-
ponents and histograms on diagonal components. he main part of the program is
straightforward:
MultiPlotModel multiPlotModel = new MultiPlotModel(dataModel);
multiPlotModel.setRowColumn(dataModel.getVariableNumber(),
dataModel.getVariableNumber());
for (int i = 0; i < dataModel.getVariableNumber(); i++) {
for (int j = 0; j < i; j++) {
PlotModel pModel =
new ScatterPlotModel(dataModel, j, i);
multiPlotModel.setPlotModel(pModel, i, j);
}
HistogramPlotModel hModel =
new HistogramPlotModel(dataModel, i);
hModel.setTitle(dataModel.getVariableName(i));
multiPlotModel.setPlotModel(hModel, i, i);
}
Another example is a parallel coordinate plot. he main part of the program is the
following:
MultiPlotModel multiPlotModel = new MultiPlotModel(dataModel);
multiPlotModel.setRowColumn(1, dataModel.getVariableNumber());
multiPlotModel.setConnect(true);
multiPlotModel.setSelector(new LineSelector());
for (int i = 0; i < dataModel.getVariableNumber(); i++) {
ScatterPlotModel plotModel =
new ScatterPlotModel(dataModel, PlotModel.NULL, i);
plotModel.setDrawXTick(false);
plotModel.setDrawYTick(false);
Limits yLimits = plotModel.getYLimits();
yLimits.setMin(dataModel.getMin(i));
yLimits.setMax(dataModel.getMax(i));
plotModel.setYLimits(yLimits);
plotModel.drawString(String.valueOf(dataModel.getMin(i)),
0.5, 0.1, DrawString.CENTER, null);