use of tech.tablesaw.plotly.components.Figure in project tablesaw by jtablesaw.
the class HorizontalBarExample method main.
public static void main(String[] args) throws Exception {
Table table = Table.read().csv("../data/tornadoes_1950-2014.csv");
Table s = table.summarize("fatalities", count).by("State");
BarTrace trace = BarTrace.builder(s.categoricalColumn(0), s.numberColumn(1)).orientation(BarTrace.Orientation.HORIZONTAL).build();
Layout layout = Layout.builder().title("Tornadoes by state").height(600).width(800).build();
Plot.show(new Figure(layout, trace));
}
use of tech.tablesaw.plotly.components.Figure in project tablesaw by jtablesaw.
the class TimeSeriesPlot method create.
public static Figure create(String title, Table table, String dateColX, String yCol, String groupCol) {
TableSliceGroup tables = table.splitOn(table.categoricalColumn(groupCol));
Layout layout = Layout.builder(title, dateColX, yCol).build();
ScatterTrace[] traces = new ScatterTrace[tables.size()];
for (int i = 0; i < tables.size(); i++) {
List<Table> tableList = tables.asTableList();
Table t = tableList.get(i).sortOn(dateColX);
traces[i] = ScatterTrace.builder(t.dateColumn(dateColX), t.numberColumn(yCol)).showLegend(true).name(tableList.get(i).name()).mode(ScatterTrace.Mode.LINE).build();
}
return new Figure(layout, traces);
}
Aggregations