SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.charts.EmpiricalChart Class Reference

Provides tools to create and manage empirical plots, which are used to plot empirical distributions. More...

Inheritance diagram for umontreal.ssj.charts.EmpiricalChart:
umontreal.ssj.charts.XYChart

Public Member Functions

 EmpiricalChart ()
 Initializes a new EmpiricalChart instance with an empty data set.
 EmpiricalChart (String title, String XLabel, String YLabel, double[]... data)
 Initializes a new EmpiricalChart instance with data data.
 EmpiricalChart (String title, String XLabel, String YLabel, double[] data, int numPoints)
 Initializes a new EmpiricalChart instance with a set of points data.
 EmpiricalChart (String title, String XLabel, String YLabel, DoubleArrayList... data)
 Similar to the above constructor, but with DoubleArrayList.
 EmpiricalChart (String title, String XLabel, String YLabel, TallyStore... tallies)
 Initializes a new EmpiricalChart instance with data arrays contained in each umontreal.ssj.stat.TallyStore object.
 EmpiricalChart (String title, String XLabel, String YLabel, XYSeriesCollection data)
 Initializes a new EmpiricalChart instance with data data.
EmpiricalSeriesCollection getSeriesCollection ()
 Returns the chart’s dataset.
void setSeriesCollection (EmpiricalSeriesCollection dataset)
 Links a new dataset to the current chart.
void setTicksSynchro (int s)
 Synchronizes \(x\)-axis ticks to the \(s\)-th series.
JFrame view (int width, int height)
 Displays chart on the screen using Swing.
LaTeX-specific method @{
String toLatex (double width, double height)
 Exports the chart to a LaTeX source code using PGF/TikZ.
Public Member Functions inherited from umontreal.ssj.charts.XYChart
JFreeChart getJFreeChart ()
 Returns the JFreeChart object associated with this chart.
Axis getXAxis ()
 Returns the chart’s domain axis ( \(x\)-axis) object.
Axis getYAxis ()
 Returns the chart’s range axis ( \(y\)-axis) object.
String getTitle ()
 Gets the current chart title.
void setTitle (String title)
 Sets a title to this chart.
void setprobFlag (boolean flag)
 Must be set true when plotting probabilities, false otherwise.
void setAutoRange ()
 The \(x\) and the \(y\) ranges of the chart are set automatically.
void setAutoRange (boolean right, boolean top)
 The \(x\) and the \(y\) ranges of the chart are set automatically.
void setAutoRange00 (boolean xZero, boolean yZero)
 The \(x\) and the \(y\) ranges of the chart are set automatically.
void setManualRange (double[] range)
 Sets the \(x\) and \(y\) ranges of the chart using the format: range = [xmin, xmax, ymin, ymax].
void setManualRange (double[] range, boolean right, boolean top)
 Sets the \(x\) and \(y\) ranges of the chart using the format: range = [xmin, xmax, ymin, ymax].
void setManualRange00 (double[] range, boolean xZero, boolean yZero)
 Sets the \(x\) and \(y\) ranges of the chart using the format: range = [xmin, xmax, ymin, ymax].
double getChartMargin ()
 Returns the chart margin, which is the fraction by which the chart is enlarged on its borders.
void setChartMargin (double margin)
 Sets the chart margin to margin.
void drawVerticalLine (double x, String name, double yfrac, boolean right)
 Draws a vertical line on the chart at \(x\)-coordinate x.
void enableGrid (double xstep, double ystep)
 Puts a grid on the background.
void disableGrid ()
 Disables the background grid.
void toLatexFile (String fileName, double width, double height)
 Transforms the chart to LaTeX form and writes it in file fileName.
void setLatexDocFlag (boolean flag)
 Flag to remove the \documentclass (and other) commands in the created LaTeX files.

Additional Inherited Members

Detailed Description

Provides tools to create and manage empirical plots, which are used to plot empirical distributions.

Each EmpiricalChart object is linked with an EmpiricalSeriesCollection data set.

Definition at line 50 of file EmpiricalChart.java.

Constructor & Destructor Documentation

◆ EmpiricalChart() [1/6]

umontreal.ssj.charts.EmpiricalChart.EmpiricalChart ( )

Initializes a new EmpiricalChart instance with an empty data set.

Definition at line 83 of file EmpiricalChart.java.

◆ EmpiricalChart() [2/6]

umontreal.ssj.charts.EmpiricalChart.EmpiricalChart ( String title,
String XLabel,
String YLabel,
double...[] data )

Initializes a new EmpiricalChart instance with data data.

title is a title, XLabel is a short description of the

\(x\)-axis and YLabel a short description of the \(y\)-axis. The input vectors data represents a collection of observation sets. Each vector of data represents a \(x\)-coordinates set. Therefore data \([i], i = 0,…,n-1\), is used to draw the \(i\)-th plot. The values of each observation set data \([i]\) must be sorted in increasing order.

Parameters
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
dataseries of point sets.

Definition at line 104 of file EmpiricalChart.java.

◆ EmpiricalChart() [3/6]

umontreal.ssj.charts.EmpiricalChart.EmpiricalChart ( String title,
String XLabel,
String YLabel,
double[] data,
int numPoints )

Initializes a new EmpiricalChart instance with a set of points data.

title is a title, XLabel is a short description of the

\(x\)-axis and YLabel a short description of the \(y\)-axis. Vector data represents a \(x\)-coordinates set. The values of this observation set must be sorted in increasing order. Only the first numPoints of data will be considered to plot.

Parameters
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
dataseries of point sets.
numPointsnumber of points to plot

Definition at line 124 of file EmpiricalChart.java.

◆ EmpiricalChart() [4/6]

umontreal.ssj.charts.EmpiricalChart.EmpiricalChart ( String title,
String XLabel,
String YLabel,
DoubleArrayList... data )

Similar to the above constructor, but with DoubleArrayList.

A DoubleArrayList from the Colt library is used to store data. The values of each observation set data \([i]\) must be sorted in increasing order.

Parameters
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
dataseries of point sets.

Definition at line 141 of file EmpiricalChart.java.

◆ EmpiricalChart() [5/6]

umontreal.ssj.charts.EmpiricalChart.EmpiricalChart ( String title,
String XLabel,
String YLabel,
TallyStore... tallies )

Initializes a new EmpiricalChart instance with data arrays contained in each umontreal.ssj.stat.TallyStore object.

The input parameter tallies represents a collection of observation sets. Therefore, the \(i\)-th tallies is used to draw the

\(i\)-th plot.

Parameters
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
talliesseries of observation sets.

Definition at line 159 of file EmpiricalChart.java.

◆ EmpiricalChart() [6/6]

umontreal.ssj.charts.EmpiricalChart.EmpiricalChart ( String title,
String XLabel,
String YLabel,
XYSeriesCollection data )

Initializes a new EmpiricalChart instance with data data.

The input parameter data represents a set of plotting data. XYSeriesCollection is a JFreeChart-like container class used to store and manage observation sets.

Parameters
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
dataseries collection.

Definition at line 176 of file EmpiricalChart.java.

Member Function Documentation

◆ getSeriesCollection()

EmpiricalSeriesCollection umontreal.ssj.charts.EmpiricalChart.getSeriesCollection ( )

Returns the chart’s dataset.

Returns
the chart’s dataset.

Definition at line 187 of file EmpiricalChart.java.

◆ setSeriesCollection()

void umontreal.ssj.charts.EmpiricalChart.setSeriesCollection ( EmpiricalSeriesCollection dataset)

Links a new dataset to the current chart.

Parameters
datasetnew dataset.

Definition at line 196 of file EmpiricalChart.java.

◆ setTicksSynchro()

void umontreal.ssj.charts.EmpiricalChart.setTicksSynchro ( int s)

Synchronizes \(x\)-axis ticks to the \(s\)-th series.

\(x\)-values.

Parameters
sseries used to define ticks.

Reimplemented from umontreal.ssj.charts.XYChart.

Definition at line 205 of file EmpiricalChart.java.

◆ toLatex()

String umontreal.ssj.charts.EmpiricalChart.toLatex ( double width,
double height )

Exports the chart to a LaTeX source code using PGF/TikZ.

This method constructs and returns a string that can be written to a LaTeX document to render the plot. width and height represents the width and the height of the produced chart. These dimensions do not take into account the axes and labels extra space. The width and the height of the chart are measured in centimeters.

Parameters
widthChart’s width in centimeters.
heightChart’s height in centimeters.
Returns
LaTeX source code.

Reimplemented from umontreal.ssj.charts.XYChart.

Definition at line 244 of file EmpiricalChart.java.

◆ view()

JFrame umontreal.ssj.charts.EmpiricalChart.view ( int width,
int height )

Displays chart on the screen using Swing.

This method creates an application containing a chart panel displaying the chart. The created frame is positioned on-screen, and displayed before it is returned. The width and the height of the chart are measured in pixels.

Parameters
widthframe width in pixels.
heightframe height in pixels.
Returns
frame containing the chart.

Reimplemented from umontreal.ssj.charts.XYChart.

Definition at line 225 of file EmpiricalChart.java.


The documentation for this class was generated from the following file: