Search in sources :

Example 21 with Figure

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

the class MarkerOptionsExample method showCustomLine.

/**
 * Shows a scatter with an outline on the marker
 */
private void showCustomLine() {
    Layout layout = Layout.builder().title("outline").xAxis(Axis.builder().title("Batting Average").build()).yAxis(Axis.builder().title("Wins").build()).build();
    Trace trace = ScatterTrace.builder(x, y).marker(Marker.builder().line(Line.builder().color("rgb(231, 99, 250)").width(1).build()).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)

Example 22 with Figure

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

the class MarkerOptionsExample method showMarkerGradient.

/**
 * Shows a scatter with a gradient. In this example we set both the type and the color (which is
 * used as the value to shade into). Color normally defaults to a dark neutral grey (black?)
 *
 * <p>The size is increased to make the gradient more visible
 */
private void showMarkerGradient() {
    Layout layout = Layout.builder().title("marker gradient").xAxis(Axis.builder().title("Batting Average").build()).yAxis(Axis.builder().title("Wins").build()).build();
    Trace trace = ScatterTrace.builder(x, y).marker(Marker.builder().size(10).gradient(Gradient.builder().type(Gradient.Type.HORIZONTAL).color("red").build()).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)

Example 23 with Figure

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

the class MarkerOptionsExample method showLargeMarkers.

/**
 * Shows a scatter with large markers
 */
private void showLargeMarkers() {
    Layout layout = Layout.builder().title("large markers").xAxis(Axis.builder().title("Batting Average").build()).yAxis(Axis.builder().title("Wins").build()).build();
    Trace trace = ScatterTrace.builder(x, y).marker(Marker.builder().size(9).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)

Example 24 with Figure

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

the class MarkerOptionsExample method showColorScale.

/**
 * 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 showColorScale() {
    Layout layout = Layout.builder().title("color scaled by # of wins").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).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 25 with Figure

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

the class MarkerOptionsExample method showRGBColor.

/**
 * Shows a scatter with color set as RGB value
 */
private void showRGBColor() {
    Layout layout = Layout.builder().title("RGB value used for marker color").xAxis(Axis.builder().title("Batting Average").build()).yAxis(Axis.builder().title("Wins").build()).build();
    Trace trace = ScatterTrace.builder(x, y).marker(Marker.builder().color("rgb(17, 157, 255)").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