use of tech.tablesaw.plotly.traces.ScatterTrace in project tablesaw by jtablesaw.
the class TimeSeriesPlot method create.
public static Figure create(String title, String xTitle, InstantColumn xCol, String yTitle, NumericColumn<?> yCol) {
Layout layout = Layout.builder(title, xTitle, yTitle).build();
ScatterTrace trace = ScatterTrace.builder(xCol, yCol).mode(ScatterTrace.Mode.LINE).build();
return new Figure(layout, trace);
}
use of tech.tablesaw.plotly.traces.ScatterTrace in project tablesaw by jtablesaw.
the class TimeSeriesPlot method create.
public static Figure create(String title, String xTitle, DateTimeColumn xCol, String yTitle, NumericColumn<?> yCol) {
Layout layout = Layout.builder(title, xTitle, yTitle).build();
ScatterTrace trace = ScatterTrace.builder(xCol, yCol).mode(ScatterTrace.Mode.LINE).build();
return new Figure(layout, trace);
}
use of tech.tablesaw.plotly.traces.ScatterTrace in project tablesaw by jtablesaw.
the class TimeSeriesPlot method createDateTimeSeries.
/**
* Creates a time series where the x values are from a DateTimeColumn, rather than a DateColumn
*
* @param title The title of the plot
* @param table The table containing the source data
* @param dateTimeColumnName The name of a DateTimeColumn
* @param numberColumnName The name of a NumberColumn
* @return The figure to be displayed
*/
public static Figure createDateTimeSeries(String title, Table table, String dateTimeColumnName, String numberColumnName) {
DateTimeColumn xCol = table.dateTimeColumn(dateTimeColumnName);
NumericColumn<?> yCol = table.numberColumn(numberColumnName);
Layout layout = Layout.builder(title, xCol.name(), yCol.name()).build();
ScatterTrace trace = ScatterTrace.builder(xCol, yCol).mode(ScatterTrace.Mode.LINE).build();
return new Figure(layout, trace);
}
use of tech.tablesaw.plotly.traces.ScatterTrace in project tablesaw by jtablesaw.
the class TimeSeriesPlot method create.
public static Figure create(String title, String xTitle, DateColumn xCol, String yTitle, NumericColumn<?> yCol) {
Layout layout = Layout.builder(title, xTitle, yTitle).build();
ScatterTrace trace = ScatterTrace.builder(xCol, yCol).mode(ScatterTrace.Mode.LINE).build();
return new Figure(layout, trace);
}
use of tech.tablesaw.plotly.traces.ScatterTrace in project tablesaw by jtablesaw.
the class TukeyMeanDifferencePlot method create.
/**
* Returns a figure containing a QQ Plot describing the differences between the distribution of
* values in the columns of interest
*
* @param title A title for the plot
* @param measure The measure being compared on the plot (e.g "inches" or "height in inches"
* @param xData The data to plot on the x Axis
* @param yData The data to plot on the y Axis
* @return A quantile plot
*/
public static Figure create(String title, String measure, double[] xData, double[] yData) {
Preconditions.checkArgument(xData.length != 0, "x Data array is empty");
Preconditions.checkArgument(yData.length != 0, "x Data array is empty");
if (xData.length != yData.length) {
double[] interpolatedData;
if (xData.length < yData.length) {
interpolatedData = interpolate(yData, xData.length);
yData = interpolatedData;
} else {
interpolatedData = interpolate(xData, yData.length);
xData = interpolatedData;
}
}
Arrays.sort(xData);
Arrays.sort(yData);
double[] averagePoints = new double[xData.length];
double[] differencePoints = new double[xData.length];
for (int i = 0; i < xData.length; i++) {
averagePoints[i] = (xData[i] + yData[i]) / 2.0;
differencePoints[i] = (xData[i] - yData[i]);
}
double xMin = StatUtils.min(xData);
double xMax = StatUtils.max(xData);
double[] zeroLineX = { xMin, xMax };
double[] zeroLineY = { 0, 0 };
// Draw the line indicating equal distributions (this is zero in this plot)
ScatterTrace trace1 = ScatterTrace.builder(zeroLineX, zeroLineY).mode(ScatterTrace.Mode.LINE).name("y = x").build();
// Draw the actual data points
ScatterTrace trace2 = ScatterTrace.builder(averagePoints, differencePoints).name("mean x difference").build();
Layout layout = Layout.builder().title(title).xAxis(Axis.builder().title("mean (" + measure + ")").build()).yAxis(Axis.builder().title("difference (" + measure + ")").build()).height(700).width(900).build();
return new Figure(layout, trace1, trace2);
}
Aggregations