use of tech.tablesaw.plotly.components.Figure in project tablesaw by jtablesaw.
the class QuantilePlot method create.
/**
* Returns a figure containing a Quantile Plot describing the distribution of values in the column
* of interest
*
* @param title A title for the plot
* @param table The table containing the column of interest
* @param columnName The name of the numeric column containing the data to plot
* @return A quantile plot
*/
public static Figure create(String title, Table table, String columnName) {
NumericColumn<?> xCol = table.nCol(columnName);
double[] x = new double[xCol.size()];
for (int i = 0; i < x.length; i++) {
x[i] = i / (float) x.length;
}
NumericColumn<?> copy = xCol.copy();
copy.sortAscending();
ScatterTrace trace = ScatterTrace.builder(x, copy.asDoubleArray()).build();
Layout layout = Layout.builder().title(title).build();
return new Figure(layout, trace);
}
use of tech.tablesaw.plotly.components.Figure in project tablesaw by jtablesaw.
the class AreaPlot method create.
public static Figure create(String title, Table table, String xCol, String yCol) {
Layout layout = Layout.builder(title, xCol, yCol).build();
ScatterTrace trace = ScatterTrace.builder(table.numberColumn(xCol), table.numberColumn(yCol)).mode(ScatterTrace.Mode.LINE).fill(ScatterTrace.Fill.TO_NEXT_Y).build();
return new Figure(layout, trace);
}
use of tech.tablesaw.plotly.components.Figure in project tablesaw by jtablesaw.
the class LineOptionsExample method showDefaultLines.
private void showDefaultLines() {
Layout layout = Layout.builder().title("Default Line Style").build();
ScatterTrace trace = ScatterTrace.builder(x, y).mode(ScatterTrace.Mode.LINE).build();
Plot.show(new Figure(layout, trace));
}
use of tech.tablesaw.plotly.components.Figure in project tablesaw by jtablesaw.
the class LineOptionsExample method showRedLines.
private void showRedLines() {
Layout layout = Layout.builder().title("Red Lines").build();
ScatterTrace trace = ScatterTrace.builder(x, y).mode(ScatterTrace.Mode.LINE).line(Line.builder().color("red").build()).build();
Plot.show(new Figure(layout, trace));
}
use of tech.tablesaw.plotly.components.Figure in project tablesaw by jtablesaw.
the class LineOptionsExample method showWideLines.
/**
* Sets the line width
*/
private void showWideLines() {
Layout layout = Layout.builder().title("Wide lines").build();
ScatterTrace trace = ScatterTrace.builder(x, y).mode(ScatterTrace.Mode.LINE).line(Line.builder().width(4).build()).build();
Plot.show(new Figure(layout, trace));
}
Aggregations