use of tech.tablesaw.plotly.components.Marker in project tablesaw by jtablesaw.
the class Scatter3DPlot method create.
public static Figure create(String title, Table table, String xCol, String yCol, String zCol, String sizeColumn, String groupCol) {
TableSliceGroup tables = table.splitOn(table.categoricalColumn(groupCol));
Layout layout = standardLayout(title, xCol, yCol, zCol, false);
Scatter3DTrace[] traces = new Scatter3DTrace[tables.size()];
for (int i = 0; i < tables.size(); i++) {
List<Table> tableList = tables.asTableList();
Marker marker = Marker.builder().size(tableList.get(i).numberColumn(sizeColumn)).build();
traces[i] = Scatter3DTrace.builder(tableList.get(i).numberColumn(xCol), tableList.get(i).numberColumn(yCol), tableList.get(i).numberColumn(zCol)).marker(marker).showLegend(true).name(tableList.get(i).name()).build();
}
return new Figure(layout, traces);
}
use of tech.tablesaw.plotly.components.Marker in project tablesaw by jtablesaw.
the class MarkerTest method asJavascript.
@Test
public void asJavascript() {
Marker x = Marker.builder().size(12.0).symbol(Symbol.DIAMOND_TALL).color("#c68486").build();
assertTrue(x.asJavascript().contains("color"));
assertTrue(x.asJavascript().contains("symbol"));
assertTrue(x.asJavascript().contains("size"));
}
use of tech.tablesaw.plotly.components.Marker in project tablesaw by jtablesaw.
the class BubblePlot method create.
public static Figure create(String title, Table table, String xCol, String yCol, String sizeColumn, String groupCol) {
TableSliceGroup tables = table.splitOn(table.categoricalColumn(groupCol));
Layout layout = Layout.builder(title, xCol, yCol).showLegend(true).build();
ScatterTrace[] traces = new ScatterTrace[tables.size()];
for (int i = 0; i < tables.size(); i++) {
List<Table> tableList = tables.asTableList();
Marker marker = Marker.builder().size(tableList.get(i).numberColumn(sizeColumn)).build();
traces[i] = ScatterTrace.builder(tableList.get(i).numberColumn(xCol), tableList.get(i).numberColumn(yCol)).showLegend(true).marker(marker).name(tableList.get(i).name()).build();
}
return new Figure(layout, traces);
}
use of tech.tablesaw.plotly.components.Marker in project tablesaw by jtablesaw.
the class BubblePlot method create.
/**
* create a bubble plot using more options including color/sizeMode/opacity
*
* @param title plot title
* @param xColumn non-nullable, column data for x-axis
* @param yColumn non-nullable, column data for y-axis
* @param sizeColumn nullable, indicate the bubble size
* @param color color for every data point
* @param sizeMode check {@link SizeMode}
* @param opacity display opacity
* @return bubble plot created from given parameters
*/
public static Figure create(String title, Column xColumn, Column yColumn, NumericColumn sizeColumn, double[] color, SizeMode sizeMode, Double opacity) {
Layout layout = Layout.builder(title, xColumn.name(), yColumn.name()).build();
Marker marker = null;
MarkerBuilder builder = Marker.builder();
if (sizeColumn != null) {
builder.size(sizeColumn);
}
if (opacity != null) {
builder.opacity(opacity);
}
if (color != null) {
builder.color(color);
}
if (sizeMode != null) {
builder.sizeMode(sizeMode);
}
marker = builder.build();
ScatterTrace trace = ScatterTrace.builder(xColumn, yColumn).marker(marker).build();
return new Figure(layout, trace);
}
use of tech.tablesaw.plotly.components.Marker in project tablesaw by jtablesaw.
the class BubbleExample method main.
public static void main(String[] args) throws IOException {
Table marketShare = Table.read().csv("../data/market_share.csv");
Table sub = marketShare.where(Selection.withRange(0, 4));
NumericColumn<?> x = sub.nCol("Products");
NumericColumn<?> y = sub.nCol("Sales");
NumericColumn<?> data = sub.nCol("Market_Share");
Layout layout = Layout.builder().title("Market Share").build();
Marker marker = Marker.builder().size(data).sizeMode(Marker.SizeMode.AREA).build();
ScatterTrace trace = ScatterTrace.builder(x, y).marker(marker).build();
Plot.show(new Figure(layout, trace));
}
Aggregations