Search in sources :

Example 1 with Trace

use of tech.tablesaw.plotly.traces.Trace 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 2 with Trace

use of tech.tablesaw.plotly.traces.Trace 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)

Example 3 with Trace

use of tech.tablesaw.plotly.traces.Trace 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 4 with Trace

use of tech.tablesaw.plotly.traces.Trace 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 5 with Trace

use of tech.tablesaw.plotly.traces.Trace 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)

Aggregations

Trace (tech.tablesaw.plotly.traces.Trace)25 Figure (tech.tablesaw.plotly.components.Figure)20 ScatterTrace (tech.tablesaw.plotly.traces.ScatterTrace)20 Layout (tech.tablesaw.plotly.components.Layout)19 Table (tech.tablesaw.api.Table)7 IntColumn (tech.tablesaw.api.IntColumn)4 Test (org.junit.jupiter.api.Test)3 Grid (tech.tablesaw.plotly.components.Grid)2 BarTrace (tech.tablesaw.plotly.traces.BarTrace)2 ArrayList (java.util.ArrayList)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 NumericColumn (tech.tablesaw.api.NumericColumn)1 Plot (tech.tablesaw.plotly.Plot)1 Page (tech.tablesaw.plotly.components.Page)1 PageBuilder (tech.tablesaw.plotly.components.Page.PageBuilder)1 HistogramTrace (tech.tablesaw.plotly.traces.HistogramTrace)1