Skip to content

Brunel Visualization Cookbook

Dan Rope edited this page Feb 5, 2016 · 6 revisions

Brunel Visualization Cookbook

Sometimes you just need a chart. Below is a list of common charts including the Brunel syntax to produce them. Click on the chart name to see a live graph and then substitute your own data. For more details, read the the interactive [language tutorial] (http://brunel.mybluemix.net/docs/).


Basic Charts

Bar of Counts Number of states for each region

data('sample:US States.csv') bar x(Region) y(#count)

Bar of Means (sorted) Average rainfall for each region sorted by the average value.

data('sample:US States.csv') bar x(Region) y(Rain) mean(Rain) sort(Rain)

Clustered Bar Chart Counts of presidential choices of states within region.

data('sample:US States.csv') bar x(Region, Presidential_Choice) y(#count) color(Presidential_Choice)

Horizontal Bars Average rainfall bars shown horizontally

data('sample:US States.csv') bar x(Region) y(Rain) mean(Rain) sort(Rain) transpose

Stacked Bars Regional income totals by presidential choice

data('sample:US States.csv') bar x(Region) y(Income) sum(Income) color(Presidential_Choice) stack

Scatterplot Summer vs. winter temperatures for the 50 US states

data('sample:US States.csv') x(Summer) y(Winter)

Scatterplot with Color Population vs. income for each US state colored by presidential choice

data('sample:US States.csv') x(Population) y(Income) color(Presidential_Choice)

Line Plot Total number of late flights per month

data('sample:AirlineDelays.csv') x(Month) y(Late) sum(Late) line

Series Lines Unemployment Rates 2005-2015 Men/Women over 20 yrs of age

data('sample:Unemployment.csv') x(#row) y(Women, Men) color(#series) line

Area Plot Total number of flights per month

data('sample:AirlineDelays.csv') x(Month) y(Count) sum(Count) area

Pie Chart Proportion of number of states in each region

data('sample:US States.csv') stack polar bar x("const") y(#count) color(region) legends(none) label(region)


Statistical Graphics

Linear Fit Summer vs winter temperatures of US states with linear fit line

data('sample:US States.csv') point x(Summer) y(Winter) + data('sample:US States.csv') line x(Summer) y(Winter) fit(Winter)

Rectangular Binned Scatterplot Distribution of whiskey ratings vs. age

data('sample:whiskey.csv') point x(Rating) y(Age) bin(Rating,Age) opacity(#count)

Smooth Line Whisky ratings vs. price with smoothed fit line

data('sample:whiskey.csv') line x(Rating) y(Price) smooth(Price) + data('sample:whiskey.csv') point x(Rating) y(Price)

Median and Inner Quartile Range Variations of summer temperatures per Region

data('sample:US States.csv') bar x(Region) yrange(Summer) iqr(Summer) + data('sample:US States.csv') point x(Region) y(Summer) median(Summer) style('symbol:rect;height:2')

Histogram Distribution of summer temperatures

data('sample:US States.csv') bar x(Summer) y(#count) bin(Summer) style("size:100%")

Brushing/Linking Whiskey price by category linked age and alcohol content (mouse over event)

data('sample:whiskey.csv') x(Category) y(Price:linear) mean(Price) bar interaction(select:mouseover) color(#selection) | data('sample:whiskey.csv') x(ABV) y(Age) color(#selection) size(#selection)


Information Visualization

Heatmap Number of games for each category and game mechanics.

data('sample:BGG Top 2000 Games.csv') x(Categories) y(Mechanics) color(#count:red) style('symbol:rect; size:100%; stroke:none') sort(#count)

Spark Line US Consumer Price Index 2005-2015

data('sample:cpi.csv') line x(#row) y(Value) axes(none)

Bubble Chart Game playing time totals per game category

data('sample:BGG Top 2000 Games.csv') bubble x(Categories) color(Categories) size(PlayingTime) label(Categories) sum(PlayingTime) legends(none)

Tag Cloud US Regions sized by average rainfall

data('sample:US States.csv') cloud color(Region) size(Rain) label(Region) mean(Rain) legends(none)

Treemap Game category within median 'language used' sized by average game rating and colored by average player age.

data('sample:BGG Top 2000 Games.csv') treemap x(Language, Categories) color(PlayerAge:continuous) size(Rating) label("Rating: ", Rating) mean(PlayerAge, Rating)

Chord Chart Category of whiskey produced by each country

data('sample:whiskey.csv') chord x(Country) y(Category) color(#count) tooltip(#all)

Filtered Bar Chart Average whiskey price per category filtered by age and alcohol content

data('sample:whiskey.csv') x(Category) y(Price:linear) mean(Price) bar filter(Age, ABV)


Maps and Networks

Map of the USA USA by states, labeled

data('sample:US States.csv') map key(state) label(state)

Rainfall over the United States Choropleth map of the USA, showing average annual rainfall

data('sample:US States.csv') map color(rain:[reds, blues]) key(state) label(state)

Multiple Attributes of States Regions show population by shadings; points show winter mean temp by size and date of statehood by color

data('sample:US States.csv') map color(population:greens) key(state) + point map color(date:[black]) size(winter:400%) key(state)

Minard's Map of Napoleon's march on Russia The width of the path is proportional to the size of the army; city names are modern

data('sample:minard-troops.csv') map('russia', 'belarus', 'lithuania') + path x(long) y(lat) color(direction) size(survivors:400%) split(group) legends(none) + map(labels)

Europe, highlighting France A background map with no data, just geography

map('Europe', 'France')

The Sierpinski Gasket Layout of the Sierpinski data -- a purely abstract network

data('sample:sierpinski.csv') edge key(a, b) + network y(a, b) color(#values) label(#values) legends(none)