1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
"""
Becker's Barley Trellis Plot
----------------------------
The example demonstrates the trellis charts created by Richard Becker, William Cleveland and others in the 1990s. Using the visualization technique below they identified an anomoly in a widely used agriculatural dataset, which they termed `"The Morris Mistake." <http://ml.stat.purdue.edu/stat695t/writings/Trellis.User.pdf>`_. It became their favored way of showcasing the power of this pioneering plot.
"""
# category: case studies
import altair as alt
from vega_datasets import data
source = data.barley()
alt.Chart(source, title="The Morris Mistake").mark_point().encode(
alt.X('yield:Q')
.title("Barley Yield (bushels/acre)")
.scale(zero=False)
.axis(grid=False),
alt.Y('variety:N')
.title("")
.sort('-x')
.axis(grid=True),
alt.Color('year:N')
.legend(title="Year"),
alt.Row('site:N')
.title("")
.sort(alt.EncodingSortField(field='yield', op='sum', order='descending'))
).properties(
height=alt.Step(20)
).configure_view(stroke="transparent")
|