Table-based Plots

Table-based Plots

Table Heatmap

using VegaLite, VegaDatasets

dataset("cars") |>
@vlplot(:rect, y=:Origin, x="Cylinders:o", color="mean(Horsepower)")
80100120140Mean of Horsepower34568CylindersEuropeJapanUSAOrigin

Table Binned heatmap

using VegaLite, VegaDatasets

dataset("movies") |>
@vlplot(
    :rect,
    width=300, height=200,
    x={:IMDB_Rating, bin={maxbins=60}},
    y={:Rotten_Tomatoes_Rating, bin={maxbins=40}},
    color="count()",
    config={
        range={
            heatmap={
                scheme="greenblue"
            }
        },
        view={
            stroke="transparent"
        }
    }
)
102030Number of Records1.42.23.03.84.65.46.27.07.88.6IMDB_Rating (binned)020406080100Rotten_Tomatoes_Rating (binned)

Table Bubble Plot (Github Punch Card)

using VegaLite, VegaDatasets

dataset("github") |>
@vlplot(
    :circle,
    y="day(time):o",
    x="hours(time):o",
    size="sum(count)"
)
1020304050Sum of count000102030405060708091011121314151617181920212223time (hours)SundayMondayTuesdayWednesdayThursdayFridaySaturdaytime (day)

Layering text over heatmap

using VegaLite, VegaDatasets

cars = dataset("cars")

@vlplot(
    data=cars,
    y="Origin:o",
    x="Cylinders:o",
    config={
        scale={bandPaddingInner=0, bandPaddingOuter=0},
        text={baseline=:middle}
    }
) +
@vlplot(:rect, color="count()") +
@vlplot(
    :text,
    text="count()",
    color={
        condition={
            test="datum['count_*'] > 100",
            value=:black
        },
        value=:white
    }
)
10866697472464320406080100Number of Records34568CylindersEuropeJapanUSAOrigin