Simple Charts

Simple Bar Chart

using VegaLite, DataFrames

data = DataFrame(
    a=["A","B","C","D","E","F","G","H","I"],
    b=[28,55,43,91,81,53,19,87,52]
)

data |> @vlplot(:bar, :a, :b)
ABCDEFGHIa020406080100b

Simple Heatmap

using VegaLite, DataFrames

x = [j for i in -5:4, j in -5:4]
y = [i for i in -5:4, j in -5:4]
z = x.^2 .+ y.^2
data = DataFrame(x=vec(x'),y=vec(y'),z=vec(z'))

data |> @vlplot(:rect, "x:o", "y:o", color=:z)
01020304050z-5-4-3-2-101234x-5-4-3-2-101234y

Simple Histogram

using VegaLite, VegaDatasets

dataset("movies") |>
@vlplot(:bar, x={:IMDB_Rating, bin=true}, y="count()")
1.02.03.04.05.06.07.08.09.010.0IMDB_Rating (binned)02004006008001,000Count of Records

Simple Line Chart

using VegaLite

x = 0:100
y = sin.(x./5)

@vlplot(:line, x=x, y={y, title="sin(x)"})
020406080100−1.0−0.50.00.51.0sin(x)

Simple Scatter Plot

using VegaLite, VegaDatasets

dataset("iris") |>
@vlplot(:point, x=:petalWidth, y=:petalLength, color=:species)
0.00.51.01.52.02.5petalWidth01234567petalLengthsetosaversicolorvirginicaspecies

TODO Add interactivity

Simple Stacked Area Chart

using VegaLite, VegaDatasets

dataset("unemployment-across-industries") |>
@vlplot(:area, x="date:t", y=:count, color=:series)
20022004200620082010date05,00010,00015,000countAgricultureBusiness servicesConstructionEducation and HealthFinanceGovernmentInformationLeisure and hospitalityManufacturingMining and ExtractionOtherSelf-employedTransportation and UtilitiesWholesale and Retail Tradeseries

Strip Plot

using VegaLite, VegaDatasets

dataset("cars") |>
@vlplot(:tick, x=:Horsepower, y="Cylinders:o")
050100150200Horsepower34568Cylinders