Search in sources :

Example 16 with Figure

use of tech.tablesaw.plotly.components.Figure in project tablesaw by jtablesaw.

the class LineOptionsExample method showSmoothedLines.

/**
 * Shows a smoothed line
 */
private void showSmoothedLines() {
    Layout layout = Layout.builder().title("Smoothed lines").build();
    ScatterTrace trace = ScatterTrace.builder(x, y).mode(ScatterTrace.Mode.LINE).line(Line.builder().shape(Line.Shape.SPLINE).smoothing(1.2).build()).build();
    Plot.show(new Figure(layout, trace));
}
Also used : Layout(tech.tablesaw.plotly.components.Layout) ScatterTrace(tech.tablesaw.plotly.traces.ScatterTrace) Figure(tech.tablesaw.plotly.components.Figure)

Example 17 with Figure

use of tech.tablesaw.plotly.components.Figure in project tablesaw by jtablesaw.

the class LinePlotExample method main.

public static void main(String[] args) throws Exception {
    Table robberies = Table.read().csv("../data/boston-robberies.csv");
    NumericColumn<?> x = robberies.nCol("Record");
    NumericColumn<?> y = robberies.nCol("Robberies");
    Layout layout = Layout.builder().title("Monthly Boston Armed Robberies Jan. 1966 - Oct. 1975").build();
    ScatterTrace trace = ScatterTrace.builder(x, y).mode(ScatterTrace.Mode.LINE).build();
    Plot.show(new Figure(layout, trace));
}
Also used : Table(tech.tablesaw.api.Table) Layout(tech.tablesaw.plotly.components.Layout) ScatterTrace(tech.tablesaw.plotly.traces.ScatterTrace) Figure(tech.tablesaw.plotly.components.Figure)

Example 18 with Figure

use of tech.tablesaw.plotly.components.Figure in project tablesaw by jtablesaw.

the class LinePlotExampleWithSmoothing method main.

public static void main(String[] args) throws Exception {
    Table robberies = Table.read().csv("../data/boston-robberies.csv");
    NumericColumn<?> x = robberies.nCol("Record");
    NumericColumn<?> y = robberies.nCol("Robberies");
    Layout layout = Layout.builder().title("Monthly Boston Armed Robberies Jan. 1966 - Oct. 1975").build();
    ScatterTrace trace = ScatterTrace.builder(x, y).mode(ScatterTrace.Mode.LINE).line(Line.builder().shape(Line.Shape.SPLINE).smoothing(1.2).build()).build();
    Plot.show(new Figure(layout, trace));
}
Also used : Table(tech.tablesaw.api.Table) Layout(tech.tablesaw.plotly.components.Layout) ScatterTrace(tech.tablesaw.plotly.traces.ScatterTrace) Figure(tech.tablesaw.plotly.components.Figure)

Example 19 with Figure

use of tech.tablesaw.plotly.components.Figure in project tablesaw by jtablesaw.

the class MarkerOptionsExample method showColorScaleWithBar.

/**
 * Shows a scatter with color set as a color scale
 *
 * <p>The color scale requires that an array of numeric values be provided, here we just scale
 * according to the number of wins the team has.
 */
private void showColorScaleWithBar() {
    Layout layout = Layout.builder().title("color scaled with color bar").xAxis(Axis.builder().title("Batting Average").build()).yAxis(Axis.builder().title("Wins").build()).build();
    IntColumn wins = baseball.intColumn("W");
    Trace trace = ScatterTrace.builder(x, y).marker(Marker.builder().color(wins.asDoubleArray()).cMinAndMax(wins.min(), wins.max()).colorScale(Marker.Palette.YL_GN_BU).showScale(true).build()).build();
    Plot.show(new Figure(layout, trace));
}
Also used : Trace(tech.tablesaw.plotly.traces.Trace) ScatterTrace(tech.tablesaw.plotly.traces.ScatterTrace) Layout(tech.tablesaw.plotly.components.Layout) IntColumn(tech.tablesaw.api.IntColumn) Figure(tech.tablesaw.plotly.components.Figure)

Example 20 with Figure

use of tech.tablesaw.plotly.components.Figure in project tablesaw by jtablesaw.

the class MarkerOptionsExample method showBowTieSymbol.

/**
 * Shows a scatter with a bowtie symbol instead of a circle. Many other options are available as
 * defined by the Symbol enum
 */
private void showBowTieSymbol() {
    Layout layout = Layout.builder().title("custom symbol type: Bow Tie").xAxis(Axis.builder().title("Batting Average").build()).yAxis(Axis.builder().title("Wins").build()).build();
    Trace trace = ScatterTrace.builder(x, y).marker(Marker.builder().symbol(Symbol.BOWTIE).build()).build();
    Plot.show(new Figure(layout, trace));
}
Also used : Trace(tech.tablesaw.plotly.traces.Trace) ScatterTrace(tech.tablesaw.plotly.traces.ScatterTrace) Layout(tech.tablesaw.plotly.components.Layout) Figure(tech.tablesaw.plotly.components.Figure)

Aggregations

Figure (tech.tablesaw.plotly.components.Figure)92 Layout (tech.tablesaw.plotly.components.Layout)72 ScatterTrace (tech.tablesaw.plotly.traces.ScatterTrace)53 Table (tech.tablesaw.api.Table)35 Test (org.junit.jupiter.api.Test)20 Trace (tech.tablesaw.plotly.traces.Trace)20 BarTrace (tech.tablesaw.plotly.traces.BarTrace)9 HistogramTrace (tech.tablesaw.plotly.traces.HistogramTrace)8 IntColumn (tech.tablesaw.api.IntColumn)7 File (java.io.File)6 TableSliceGroup (tech.tablesaw.table.TableSliceGroup)6 Marker (tech.tablesaw.plotly.components.Marker)4 Scatter3DTrace (tech.tablesaw.plotly.traces.Scatter3DTrace)4 ArrayList (java.util.ArrayList)3 Page (tech.tablesaw.plotly.components.Page)3 BoxTrace (tech.tablesaw.plotly.traces.BoxTrace)3 PieTrace (tech.tablesaw.plotly.traces.PieTrace)3 ViolinTrace (tech.tablesaw.plotly.traces.ViolinTrace)3 StringColumn (tech.tablesaw.api.StringColumn)2 Column (tech.tablesaw.columns.Column)2