Histogram

Source code notebook

using InMemoryDatasets, DLMReader, StatisticalGraphics

Histogram draw histogram for given column.

ds = Dataset(x=randn(10000))

sgplot(ds, Histogram(x=:x))

Assigning the y keyword argument, produce horizontal plot

sgplot(ds, Histogram(y=:x))

By default Histogram compute pdf, however, user may pass :cdf, :count, ... or anyother for scaling the bars

sgplot(ds, Histogram(x=:x, scale=:cdf))

Like other plots, Histogram support group,

iris = filereader(joinpath(dirname(pathof(StatisticalGraphics)),
                                 "..", "docs", "assets", "iris.csv"))

sgplot(iris,
        Histogram(x=:SepalLength, group=:Species, opacity=0.5)
)

Passing midpoints allows more control on bin selection

sgplot(iris,
        Histogram(x=:SepalLength,
                    group=:Species,
                    opacity=0.5,
                    midpoints=3.5:.4:8
                )
)

This page was generated using DemoCards.jl and Literate.jl.