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));
}
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));
}
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));
}
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));
}
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));
}
Aggregations