use of tech.tablesaw.plotly.traces.HistogramTrace in project tablesaw by jtablesaw.
the class HistogramOverlayExample method main.
public static void main(String[] args) throws Exception {
Table baseball = Table.read().csv("../data/baseball.csv");
Layout layout = Layout.builder().title("Distribution of team batting averages").barMode(Layout.BarMode.OVERLAY).showLegend(true).build();
TableSliceGroup groups = baseball.splitOn("league");
Table t1 = groups.get(0).asTable();
HistogramTrace trace1 = HistogramTrace.builder(t1.nCol("BA")).name("American Leage").opacity(.75).nBinsX(24).marker(Marker.builder().color("#FF4136").build()).build();
Table t2 = groups.get(1).asTable();
HistogramTrace trace2 = HistogramTrace.builder(t2.nCol("BA")).name("National League").opacity(.75).nBinsX(24).marker(Marker.builder().color("#7FDBFF").build()).build();
Plot.show(new Figure(layout, trace1, trace2));
}
use of tech.tablesaw.plotly.traces.HistogramTrace in project tablesaw by jtablesaw.
the class HistogramProbabilityExample method main.
public static void main(String[] args) throws Exception {
Table baseball = Table.read().csv("../data/baseball.csv");
Layout layout = Layout.builder().title("Probability Histogram of team batting averages").build();
HistogramTrace trace = HistogramTrace.builder(baseball.nCol("BA")).histNorm(HistogramTrace.HistNorm.PROBABILITY).build();
Plot.show(new Figure(layout, trace));
}
use of tech.tablesaw.plotly.traces.HistogramTrace in project tablesaw by jtablesaw.
the class HistogramTraceTest method testAsJavascript.
@Test
public void testAsJavascript() {
HistogramTrace trace1 = HistogramTrace.builder(y1).build();
System.out.println(trace1.asJavascript(1));
}
use of tech.tablesaw.plotly.traces.HistogramTrace in project tablesaw by jtablesaw.
the class HistogramTraceTest method show.
@Test
public void show() {
Layout layout = Layout.builder().barMode(Layout.BarMode.OVERLAY).build();
HistogramTrace trace1 = HistogramTrace.builder(y1).opacity(.75).build();
HistogramTrace trace2 = HistogramTrace.builder(y2).opacity(.75).build();
Plot.show(new Figure(layout, trace1, trace2));
}
use of tech.tablesaw.plotly.traces.HistogramTrace in project tablesaw by jtablesaw.
the class DistributionVisualizations method main.
public static void main(String[] args) throws Exception {
Table property = Table.read().csv("../data/sacramento_real_estate_transactions.csv");
IntColumn sqft = property.intColumn("sq__ft");
IntColumn price = property.intColumn("price");
sqft.set(sqft.isEqualTo(0), IntColumnType.missingValueIndicator());
price.set(price.isEqualTo(0), IntColumnType.missingValueIndicator());
Plot.show(Histogram.create("Distribution of prices", property.numberColumn("price")));
Layout layout = Layout.builder().title("Distribution of property sizes").build();
HistogramTrace trace = HistogramTrace.builder(property.numberColumn("sq__ft")).marker(Marker.builder().color("#B10DC9").opacity(.70).build()).build();
Plot.show(new Figure(layout, trace));
Plot.show(Histogram2D.create("Distribution of price and size", property, "price", "sq__ft"));
Plot.show(BoxPlot.create("Prices by property type", property, "type", "price"));
}
Aggregations