umontreal.iro.lecuyer.charts
Class PlotFormat
- java.lang.Object
-
- umontreal.iro.lecuyer.charts.PlotFormat
-
public class PlotFormat extends java.lang.ObjectProvide tools to import and export data set tables to and from Gnuplot, MATLAB and Mathematica compatible formats, or customized format.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static double[][]fromCSV(java.lang.String data)Parses data according to the standard CSV format and stores the extracted values in the returned table.static double[][]fromCustomizedFormat(java.lang.String betweenValues, java.lang.String endLine, java.lang.String data)Parses data according to a user defined format and stores the extracted values in the returned table.static double[][]fromGNUPlot(java.lang.String data)Parses data according to the standard GNUPlot format and stores the extracted values in the returned table.static java.lang.StringtoCSV(double[]... data)Stores data tables data into a String with format CSV (comma-separated value tabular data).static java.lang.StringtoCSV(XYSeriesCollection data)Stores series collection data into a String with format CSV (comma-separated value tabular data).static java.lang.StringtoCustomizedFormat(java.lang.String heading, java.lang.String footer, java.lang.String betweenValues, java.lang.String endLine, int precision, double[]... data)Stores data tables data into a String with customized format.static java.lang.StringtoCustomizedFormat(java.lang.String heading, java.lang.String footer, java.lang.String betweenValues, java.lang.String endLine, int precision, XYSeriesCollection data)Stores data tables data into a String with customized format from an XYSeriesCollection variable.static java.lang.StringtoGNUPlot(double[]... data)Stores data tables data into a String, with format understandable by GNUPlot.static java.lang.StringtoGNUPlot(XYSeriesCollection data)Stores series collection data into a String, with format understandable by GNUPlot.
-
-
-
Method Detail
-
fromGNUPlot
public static double[][] fromGNUPlot(java.lang.String data)
Parses data according to the standard GNUPlot format and stores the extracted values in the returned table. All unrecognized characters and empty lines will be cut. Deleting comments inside the input String is recommended.- Parameters:
data- String to parse.- Returns:
- Table that represent data contained in data.
- Throws:
java.lang.IllegalArgumentException- if each line of the input String doesn't share the same number of values
-
fromCSV
public static double[][] fromCSV(java.lang.String data)
Parses data according to the standard CSV format and stores the extracted values in the returned table.- Parameters:
data- String to parse.- Returns:
- Table that represent data contained in data.
- Throws:
java.lang.IllegalArgumentException- if each line of the input String doesn't share the same number of values
-
fromCustomizedFormat
public static double[][] fromCustomizedFormat(java.lang.String betweenValues, java.lang.String endLine, java.lang.String data)Parses data according to a user defined format and stores the extracted values in the returned table. betweenValues sets characters between values on the same line and endLine sets characters which separates each line of the input data set. Usually, this parameter contains the classic end of line character %n. This method uses regular expressions, so it is possible to use regular characters as defined in the standard java API, specially in the classPattern(package java.util.regex).- Parameters:
betweenValues- String which separates values on the same line.endLine- String which separates lines.data- String to parse.- Returns:
- Table that represent data contained in data.
- Throws:
java.lang.IllegalArgumentException- if each line of the input String doesn't share the same number of values
-
toGNUPlot
public static java.lang.String toGNUPlot(double[]... data)
Stores data tables data into a String, with format understandable by GNUPlot.- Parameters:
data- data tables.- Returns:
- String that represent data tables in GNUPlot format.
-
toGNUPlot
public static java.lang.String toGNUPlot(XYSeriesCollection data)
Stores series collection data into a String, with format understandable by GNUPlot.- Parameters:
data- data tables.- Returns:
- String that represent data tables in GNUPlot format.
-
toCSV
public static java.lang.String toCSV(double[]... data)
Stores data tables data into a String with format CSV (comma-separated value tabular data). The output string could be imported from a file to a matrix into Mathematica with Mathematica's function Import["fileName", "CSV"], or into MATLAB with MATLAB's function csvread('fileName').- Parameters:
data- data tables.- Returns:
- String that represent data tables in CSV format.
-
toCSV
public static java.lang.String toCSV(XYSeriesCollection data)
Stores series collection data into a String with format CSV (comma-separated value tabular data).- Parameters:
data- data tables.- Returns:
- String that represent data tables in CSV format.
-
toCustomizedFormat
public static java.lang.String toCustomizedFormat(java.lang.String heading, java.lang.String footer, java.lang.String betweenValues, java.lang.String endLine, int precision, double[]... data)Stores data tables data into a String with customized format. heading sets the head of the returned String, footer sets its end, betweenValues sets characters between values on the same line and finally endLine sets characters which separates each line of the input data set. Normally, this parameter contains the classic end of line character `%n'.- Parameters:
heading- head of the returned String.footer- end of the returned String.betweenValues- String which separates values on the same line.endLine- String which separates lines.data- data tables.- Returns:
- String that represent data tables in customized format.
-
toCustomizedFormat
public static java.lang.String toCustomizedFormat(java.lang.String heading, java.lang.String footer, java.lang.String betweenValues, java.lang.String endLine, int precision, XYSeriesCollection data)Stores data tables data into a String with customized format from an XYSeriesCollection variable.- Parameters:
heading- head of the returned String.footer- end of the returned String.betweenValues- String which separates values on the same line.endLine- String which separates lines.data- data tables.- Returns:
- String that represent data tables in customized format.
-
-
DMelt 3.0 © DataMelt by jWork.ORG