Skip to content

Instantly share code, notes, and snippets.

@kcsluis
Last active October 23, 2019 22:45
Show Gist options
  • Save kcsluis/ba2367a505726b02fb86 to your computer and use it in GitHub Desktop.
Save kcsluis/ba2367a505726b02fb86 to your computer and use it in GitHub Desktop.
Modern Lib. 100 — Final
RANKING BOOK AUTHOR BORN DIED LIFESPAN CONTINENT NATION CITY GENDER YEAR_BOOK AGE_BOOK FIRST_NOVEL AGE_FIRST_NOVEL EDITORS_WIKI WIKIPEDIA_VIEWS DIFF
73 The Day of the Locust Nathanael West 1903 1940 37 north america united states new york male 1939 36 1931 28 157 39626 0
88 The Call of the Wild Jack London 1876 1916 40 north america united states san francisco male 1903 27 1900 24 1027 263001 0
2 The Great Gatsby F. Scott Fitzgerald 1896 1940 44 north america united states Saint Paul male 1925 29 1920 24 3226 4327393 0
28 Tender Is the Night F. Scott Fitzgerald 1896 1940 44 north america united states Saint Paul male 1934 38 1920 24 179 143146 9
9 Sons and Lovers D. H. Lawrence 1885 1930 45 europe United Kingdom eastwood male 1913 28 1911 26 155 116782 0
48 The Rainbow D. H. Lawrence 1885 1930 45 europe United Kingdom eastwood male 1915 30 1911 26 72 43055 2
49 Women in Love D. H. Lawrence 1885 1930 45 europe United Kingdom eastwood male 1920 35 1911 26 142 80018 5
31 Animal Farm George Orwell 1903 1950 47 asia india motihari male 1945 42 1934 31 3170 1130155 0
13 1984 (Nineteen Eighty-Four) George Orwell 1903 1950 47 asia india motihari male 1949 46 1934 31 3942 1539741 4
55 On the Road Jack Kerouac 1922 1969 47 north america united states lowell (massachussetts) male 1957 35 1950 28 714 929722 0
11 Under the Volcano Malcolm Lowry 1909 1957 48 europe United Kingdom Birkenhead, Cheshire male 1947 38 1933 24 152 44675 0
17 The Heart Is a Lonely Hunter Carson McCullers 1917 1967 50 north america united states columbus (georgia) female 1940 23 1940 23 161 82164 0
20 Native Son Richard Wright 1908 1960 52 north america united states roxie (mississippi) male 1940 32 1940 32 378 107566 0
62 From Here to Eternity James Jones 1921 1977 56 north america united states robinson (illinois) male 1951 30 1951 30 84 19197 12
3 A Portrait of the Artist as a Young Man James Joyce 1882 1941 59 europe ireland dublin male 1916 34 1916 34 293 170027 0
1 Ulysses James Joyce 1882 1941 59 europe ireland dublin male 1922 40 1916 34 1032 654691 6
77 Finnegans Wake James Joyce 1882 1941 59 europe ireland dublin male 1939 57 1916 34 625 265910 17
15 To the Lighthouse Virginia Woolf 1882 1941 59 europe United Kingdom london female 1927 45 1915 33 220 126858 0
45 The Sun Also Rises Ernest Hemingway 1899 1961 62 north america united states oak park male 1926 27 1926 27 571 378145 0
74 A Farewell to Arms Ernest Hemingway 1899 1961 62 north america united states oak park male 1929 30 1926 27 505 299394 3
34 A Handful of Dust Evelyn Waugh 1903 1966 63 europe united kingdom london male 1934 31 1928 25 93 44141 0
75 Scoop Evelyn Waugh 1903 1966 63 europe united kingdom london male 1938 35 1928 25 104 20959 4
80 Brideshead Revisited Evelyn Waugh 1903 1966 63 europe united kingdom london male 1945 42 1928 25 491 213596 7
39 Go Tell It on the Mountain James Baldwin 1924 1987 63 north america united states new york male 1953 29 1953 29 151 51855 0
87 The Old Wives' Tale Arnold Bennett 1867 1931 64 europe United Kingdom hanley male 1908 41 1898 31 41 6598 0
22 Appointment in Samarra John O'Hara 1905 1970 65 north america united states princeton (new jersey) male 1934 29 1934 29 85 35923 0
24 Winesburg, Ohio Sherwood Anderson 1876 1941 65 north america united states Camden (Ohio) male 1919 43 1916 40 136 49663 0
6 The Sound and the Fury William Faulkner 1897 1962 65 north america united states new albany (mississippi) male 1929 32 1926 29 480 27036 0
35 As I Lay Dying William Faulkner 1897 1962 65 north america united states new albany (mississippi) male 1930 33 1926 29 520 213521 1
54 Light in August William Faulkner 1897 1962 65 north america united states new albany (mississippi) male 1932 35 1926 29 184 58120 2
30 The Good Soldier Ford Madox Ford 1873 1939 66 europe United Kingdom merton male 1915 42 1892 19 93 46876 0
57 Parade's End Ford Madox Ford 1873 1939 66 europe United Kingdom merton male 1950 77 1892 19 86 199394 35
10 The Grapes of Wrath John Steinbeck 1902 1968 66 north america united states salinas (california) male 1939 37 1929 27 1301 567963 0
90 Midnight's Children Salman Rushdie 1947 2013 66 asia india bombay male 1981 34 1975 28 315 433305 0
68 Main Street Sinclair Lewis 1885 1951 66 north america united states sauk centre male 1920 35 1914 29 99 27965 0
56 The Maltese Falcon Dashiell Hammett 1894 1961 67 north america united states saint mary's county male 1930 36 1929 35 314 72049 0
85 Lord Jim Joseph Conrad 1857 1924 67 europe Ukraine berdychiv male 1900 43 1895 38 186 66000 0
67 Heart of Darkness Joseph Conrad 1857 1924 67 europe russia berdychiv male 1902 45 1895 38 1200 739884 2
47 Nostromo Joseph Conrad 1857 1924 67 europe Ukraine berdychiv male 1904 47 1895 38 175 89046 2
46 The Secret Agent Joseph Conrad 1857 1924 67 europe Ukraine berdychiv male 1907 50 1895 38 211 65583 3
12 The Way of All Flesh Samuel Butler 1835 1902 67 europe United Kingdom langar rectory male 1903 68 1872 37 104 25511 0
89 Loving Henry Green 1905 1973 68 europe United Kingdom tewkesbury male 1945 40 1926 21 70 9168 0
44 Point Counter Point Aldous Huxley 1894 1963 69 europe United Kingdom godalming male 1928 34 1921 27 111 24050 0
5 Brave New World Aldous Huxley 1894 1963 69 europe United Kingdom godalming male 1932 38 1921 27 2335 909298 4
63 The Wapshot Chronicle John Cheever 1912 1982 70 north america united states quincy (massachussetts) male 1957 45 1957 45 36 6951 0
78 Kim Rudyard Kipling 1865 1936 71 asia india bombay male 1901 36 1891 26 306 81718 0
26 The Wings of the Dove Henry James 1843 1916 73 north america united states new york male 1902 59 1875 32 78 37349 0
27 The Ambassadors Henry James 1843 1916 73 north america united states new york male 1903 60 1875 32 87 24368 1
32 The Golden Bowl Henry James 1843 1916 73 north america united states new york male 1904 61 1875 32 88 30993 1
84 The Death of the Heart Elizabeth Bowen 1899 1973 74 europe ireland dublin female 1938 39 1927 28 46 9675 0
42 Deliverance James Dickey 1923 1997 74 north america united states atlanta (georgia) male 1970 47 1970 47 97 25503 0
23 U.S.A. trilogy John Dos Passos 1896 1970 74 north america united states chicago male 1936 40 1920 24 103 31303 0
33 Sister Carrie Theodore Dreiser 1871 1945 74 north america united states terre haute (indiana) male 1900 29 1900 29 116 57426 0
16 An American Tragedy Theodore Dreiser 1871 1945 74 north america united states terre haute (indiana) male 1925 54 1900 29 178 58360 25
60 The Moviegoer Walker Percy 1916 1990 74 north america united states birmingham, alabama male 1961 45 1961 45 64 33838 0
61 Death Comes for the Archbishop Willa Cather 1873 1947 74 north america united states gore (virginia) female 1927 54 1912 39 79 20693 0
69 The House of Mirth Edith Wharton 1862 1937 75 north america united states new york female 1905 43 1902 40 191 73495 0
58 The Age of Innocence Edith Wharton 1862 1937 75 north america united states new york female 1920 58 1902 40 262 169068 15
29 The Studs Lonigan Trilogy James T. Farrell 1904 1979 75 north america united states chicago male 1935 31 1932 28 71 11572 0
65 A Clockwork Orange Anthony Burgess 1917 1993 76 europe United Kingdom Manchester male 1962 45 1956 39 1903 664310 0
7 Catch-22 Joseph Heller 1923 1999 76 north america united states new york male 1961 38 1961 38 999 559705 0
71 A High Wind in Jamaica Richard Hughes 1900 1976 76 europe United Kingdom weybridge male 1929 29 1929 29 84 11200 0
100 The Magnificent Ambersons Booth Tarkington 1869 1946 77 north america united states indianapolis male 1918 49 1899 30 84 19664 0
8 Darkness at Noon Arthur Koestler 1905 1983 78 europe austria-hungary budapest male 1940 35 1939 34 207 84295 0
70 The Alexandria Quartet Lawrence Durrell 1912 1990 78 asia india jalandar male 1960 48 1935 23 90 24754 0
37 The Bridge of San Luis Rey Thornton Wilder 1897 1975 78 north america united states hamden (connecticut) male 1927 30 1926 29 176 53040 0
4 Lolita Vladimir Nabokov 1899 1977 78 asia russia st. petersburg male 1955 56 1926 27 1342 1018117 0
53 Pale Fire Vladimir Nabokov 1899 1977 78 asia russia st. petersburg male 1962 63 1926 27 183 76356 7
93 The Magus John Fowles 1926 2005 79 europe United Kingdom leigh-on-sea male 1965 39 1963 37 138 54578 0
95 Under the Net Iris Murdoch 1919 1999 80 europe ireland dublin female 1954 35 1954 35 43 16131 0
52 Portnoy's Complaint Philip Roth 1933 2013 80 north america united states newark (new jersey) male 1969 36 1959 26 153 95158 0
19 Invisible Man Ralph Ellison 1914 1994 80 north america united states oklahoma city male 1952 38 1952 38 531 243591 0
72 A House for Mr. Biswas V. S. Naipaul 1932 2013 81 south america trinidad and tobago trinidad male 1961 29 1957 25 1 2450 0
83 A Bend in the River V. S. Naipaul 1932 2013 81 south america trinidad and tobago trinidad male 1979 47 1957 25 73 31447 18
96 Sophie's Choice William Styron 1925 2006 81 north america united states newport news (virginia) male 1979 54 1951 26 197 114981 0
86 Ragtime E. L. Doctorow 1931 2013 82 north america united states new york male 1975 44 1960 29 145 55885 0
41 Lord of the Flies William Golding 1911 1993 82 europe United Kingdom newquay male 1954 43 1954 43 3243 900501 0
91 Tobacco Road Erskine Caldwell 1903 1987 84 north america united states Coweta County male 1932 29 1929 26 87 18762 0
59 Zuleika Dobson Max Beerbohm 1872 1956 84 europe United Kingdom london male 1911 39 1911 39 64 12766 0
51 The Naked and the Dead Norman Mailer 1923 2007 84 north america united states Long Branch (New Jersey) male 1948 25 1948 25 124 43506 0
36 All the King's Men Robert Penn Warren 1905 1989 84 north america united states Madison (Wisconsin) male 1946 41 1939 34 295 129388 0
82 Angle of Repose Wallace Stegner 1909 1993 84 north america united states lake mills (iowa) male 1971 62 1937 28 82 22714 0
98 The Postman Always Rings Twice James M. Cain 1892 1977 85 north america united states annapolis (maryland) male 1934 42 1934 42 148 15935 0
18 Slaughterhouse-Five Kurt Vonnegut 1922 2007 85 north america united states indianapolis male 1969 47 1952 30 1169 467964 0
92 Ironweed William Kennedy 1928 2013 85 north america united states Albany (NY) male 1983 55 1969 41 78 4535 0
40 The Heart of the Matter Graham Greene 1904 1991 87 europe United Kingdom berkhamsted male 1948 44 1929 25 188 46658 0
99 The Ginger Man J. P. Donleavy 1926 2013 87 north america united states new york male 1955 29 1955 29 82 25414 0
76 The Prime of Miss Jean Brodie Muriel Spark 1918 2006 88 europe United Kingdom edinburgh female 1961 43 1957 39 208 56395 0
50 Tropic of Cancer Henry Miller 1891 1980 89 north america united states new york male 1934 43 1927 36 234 138589 0
94 Wide Sargasso Sea Jean Rhys 1890 1979 89 south america dominica roseau female 1966 76 1928 38 204 119359 0
97 The Sheltering Sky Paul Bowles 1910 1999 89 north america united states new york male 1949 39 1949 39 134 39443 0
14 I, Claudius Robert Graves 1895 1985 90 europe United Kingdom london male 1934 39 1925 30 319 91637 0
81 The Adventures of Augie March Saul Bellow 1915 2005 90 north america Canada Lachine (Quebec) male 1953 38 1944 29 76 31432 0
21 Henderson the Rain King Saul Bellow 1915 2005 90 north america Canada Lachine (Quebec) male 1959 44 1944 29 90 22399 6
38 Howards End E. M. Forster 1879 1970 91 europe United Kingdom london male 1910 31 1905 26 120 80119 2
25 A Passage to India E. M. Forster 1879 1970 91 europe United Kingdom london male 1924 45 1905 26 226 139634 14
79 A Room with a View E. M. Forster 1879 1970 91 europe United Kingdom london male 1908 29 1905 26 253 125457 0
64 The Catcher in the Rye J. D. Salinger 1919 2010 91 north america united states new york male 1951 32 1951 32 4037 1191849 0
66 Of Human Bondage W. Somerset Maugham 1874 1965 91 europe france paris male 1915 41 1897 23 189 96953 0
43 A Dance to the Music of Time Anthony Powell 1905 2000 95 europe United Kingdom london male 1975 70 1931 26 123 49812 0
<!DOCTYPE html>
<meta charset="utf-8">
<style type="text/css">
body {
font-family: "Georgia", serif;
font-size: 9px;
width: 960px;
margin: 40px auto;
background-color: #eeeae1;
color: #333;
}
h1 {
color: #650000;
font-size: 28px;
}
h3 {
color: #650000;
font-size: 12px;
}
svg {
}
.container {
margin-bottom: 12px;
}
.block {
margin-bottom: 3px;
display: inline-block;
vertical-align: middle;
}
.about {
width: 600px;
line-height: 2;
font-size: 11px;
}
.legendContainer {
margin-top: 36px;
}
.w180 {
width: 180px;
display: inline-block;
}
.w600 {
width: 567px;
padding-left: 28px;
display: inline-block;
}
.authorBlock {
width: 180px;
}
.authorName {
font-size: 15px;
font-weight: bold;
color: #333;
margin-bottom: 4px;
}
.authorYears {
color: #888;
margin-left: 3px;
}
.asia {
color: #266538;
}
.europe {
color: #146b89;
}
.northamerica {
color: #820c22;
}
.southamerica {
color: #b15a9f;
}
.dashLine {
stroke: #bbb;
stroke-width: 1px;
stroke-dasharray: 5,5;
}
.timelineLegend {
fill: #888;
text-anchor: left;
}
.timelineBaseline {
stroke: #888;
stroke-width: 1px;
}
.timelineActive {
fill: #897553;
opacity: 0.33;
}
.timelineStart {
fill: #888;
}
.timelineEnd {
fill: #eeeae1;
stroke: #888;
stroke-width: 1px;
}
.sublabel {
fill: #888;
}
.bookCircleLabel {
text-anchor: middle;
}
.booksBlock {
width: 180px;
}
.book {
margin-right: 2px;
line-height: 1.5;
display: inline-block;
color: #888;
}
.book:after {
content: ",";
}
.book:last-of-type:after {
content: "";
}
.book0 {
fill: #7a419f;
}
.book1 {
fill: #de57a3;
}
.book2 {
fill: #ea7c2d;
}
.book3 {
fill: #e4c90a;
}
.legendCircle {
width: 7px;
height: 7px;
margin-right: 5px;
}
.d1 {
display: none;
}
</style>
<body>
<h1>Modern Library's<br>100 Best Novels and Authors</h1>
<p class="about">In 1998, the Modern Library, an American Publishing house, published a list of the 100 best novels of the twentieth century. In 2013, Accurat visualized the creative output of the authors of these novels. The below graphic visualizes this same data, including information about the author's origin, lifespan, and creative output, as well the name, year, and author's age for each novel on the list.</p>
<div class="legendContainer">
<h3 class="w180">Author</h3>
<h3 class="w600">Timeline</h3>
<h3 class="w180">Works, Chronological Order</h3>
</div>
<div class="mainContainer"></div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script>
<script type="text/javascript">
var margin = {top: 10, right: 30, bottom: 10, left: 30};
var width = 600 - margin.left - margin.right,
height = 40 - margin.top - margin.bottom;
var xScale = d3.scale.linear()
.range([0,width]);
d3.tsv("books_authors.tsv", ready);
function ready(error, data) {
if (error) return console.warn(error);
function capitalizeEachWord(str) {
return str.replace(/\w\S*/g, function(txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
};
data.forEach( function (d) {
d.AGE_BOOK = +d.AGE_BOOK;
d.AGE_FIRST_NOVEL = +d.AGE_FIRST_NOVEL;
d.BORN = +d.BORN;
d.DIED = +d.DIED;
d.DIFF = +d.DIFF;
d.EDITORS_WIKI = +d.EDITORS_WIKI;
d.FIRST_NOVEL = +d.FIRST_NOVEL;
d.LIFESPAN = +d.LIFESPAN;
d.RANKING = +d.RANKING;
d.WIKIPEDIA_VIEWS = +d.WIKIPEDIA_VIEWS;
d.YEAR_BOOK = +d.YEAR_BOOK;
d.NATION = capitalizeEachWord(d.NATION);
d.ACTIVE_SPAN = d.LIFESPAN - d.AGE_FIRST_NOVEL;
});
data.sort( function (a,b) { return a.AGE_BOOK - b.AGE_BOOK; });
var xLifespan = data.map( function (d) { return d.LIFESPAN; });
var xMax = d3.max(xLifespan);
//console.log(xMax);
var nestedData = d3.nest()
.key(function(d) { return d.AUTHOR; })
.entries(data);
nestedData.forEach( function (d) {
d.BORN = +d.values[0].BORN;
d.DIED = +d.values[0].DIED;
d.AGE_FIRST_NOVEL = +d.values[0].AGE_FIRST_NOVEL;
d.LIFESPAN = +d.values[0].LIFESPAN;
d.CONTINENT_CLASS = d.values[0].CONTINENT.replace(" ","");
d.NATION = capitalizeEachWord(d.values[0].NATION);
d.ACTIVE_SPAN = +d.values[0].LIFESPAN - +d.values[0].AGE_FIRST_NOVEL;
});
nestedData.sort( function (a,b) { return a.LIFESPAN - b.LIFESPAN; });
// for all values within each object in nestedData
// sort a,b a-b
var container = d3.select("body").select("div.mainContainer").selectAll("div.container")
.data(nestedData)
.enter()
.append("div")
.attr("class", function (d) { return "container " + d.key; });
// build containers
var authorContainer = d3.selectAll("div.container");
authorContainer.append("div").attr("class", "authorBlock block");
authorContainer.append("div").attr("class", "timelineBlock block");
authorContainer.append("div").attr("class", "booksBlock block");
// add author information
var authorBlockInfo = d3.selectAll("div.authorBlock");
authorBlockInfo.append("div")
.attr("class", "authorName")
.text( function (d) { return d.key; });
authorBlockInfo.append("span")
.attr("class", function (d) { return "authorCountry " + d.CONTINENT_CLASS; })
.text( function (d) { return d.NATION; });
authorBlockInfo.append("span")
.attr("class", "authorYears")
.text( function (d) { return d.BORN + "—" + d.DIED; });
// add timeline
var timelineBlockInfo = authorContainer.select("div.timelineBlock");
timelineBlockInfo.append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
xScale.domain([0,xMax]);
var rectHeight = 5;
var bookRadius = 5;
var timelineDraw = timelineBlockInfo.selectAll("g")
.append('g');
timelineDraw.append("line")
.attr("class", "dashLine")
.attr("x1", 0)
.attr("x2", width)
.attr("y1", height/2)
.attr("y2", height/2);
timelineDraw.append("line")
.attr("class", "timelineBaseline")
.attr("x1", 0)
.attr("x2", function (d) { return xScale(d.LIFESPAN); })
.attr("y1", height/2)
.attr("y2", height/2);
timelineDraw.append("rect")
.attr("class", "timelineActive")
.attr("width", function (d) { return xScale(d.ACTIVE_SPAN); })
.attr("height", rectHeight)
.attr("x", function (d) { return xScale(d.LIFESPAN - d.ACTIVE_SPAN); })
.attr("y", height/2-rectHeight/2);
timelineDraw.append("circle")
.attr("class", "timelineStart")
.attr("r", rectHeight/2)
.attr("cx", function (d) { return xScale(d.AGE_FIRST_NOVEL); })
.attr("cy", height/2);
timelineDraw.append("circle")
.attr("class", "timelineEnd")
.attr("r", rectHeight/2)
.attr("cx", function (d) { return xScale(d.LIFESPAN); })
.attr("cy", height/2);
timelineDraw.append("text")
.attr("text-anchor", "middle")
.attr("class", "sublabel")
.attr("dy", height/2-bookRadius-5)
.attr("dx", function (d) { return xScale(d.AGE_FIRST_NOVEL); })
.text( function (d) { return d.AGE_FIRST_NOVEL; });
timelineDraw.append("text")
.attr("text-anchor", "middle")
.attr("class", "sublabel")
.attr("dy", height/2-bookRadius-5)
.attr("dx", function (d) { return xScale(d.LIFESPAN); })
.text( function (d) { return d.LIFESPAN; });
timelineDraw.selectAll(".bookCircleGhost")
.data( function (d) { return d.values; })
.enter()
.append("circle")
.attr("class", function (d, i) { return "bookCircleGhost book" + i; })
.attr("r", bookRadius*3)
.style("opacity", 0.25)
.attr("cy", height/2)
.attr("cx", function (d) { return xScale(d.AGE_BOOK); });
timelineDraw.selectAll(".bookCircle")
.data( function (d) { return d.values; })
.enter()
.append("circle")
.attr("class", function (d, i) { return "bookCircle book" + i; })
.attr("r", bookRadius)
.attr("cy", height/2)
.attr("cx", function (d) { return xScale(d.AGE_BOOK); })
timelineDraw.selectAll(".bookCircleLabel")
.data( function (d) { return d.values; })
.enter()
.append("text")
.attr("class", function (d) { return "bookAge d" + d.DIFF;})
.attr("text-anchor", "middle")
.attr("dy", height/2+bookRadius+10)
.attr("dx", function (d) { return xScale(d.AGE_BOOK); })
.text( function (d) { return d.AGE_BOOK; });
// add books
var booksBlockInfo = authorContainer.select("div.booksBlock");
var eachBookInfo = booksBlockInfo.selectAll(".book")
.data( function (d) { return d.values; })
.enter()
.append("div");
var booksBlockSVG = eachBookInfo.append('svg')
.attr("class", "legendCircle");
booksBlockSVG.append("circle")
.attr("class", function (d, i) { return "book" + i; })
.attr("r", 3.5)
.attr("cx", 3.5)
.attr("cy", 3.5);
eachBookInfo.append("span")
.attr("class", "book")
.text( function (d) { return d.BOOK; });
// add legend
var legendTimeline = d3.select('div.West div.timelineBlock svg g g');
legendTimeline.append("text")
.attr("class", "timelineLegend")
.attr("dy", height/2+bookRadius+10)
.attr("dx", 0)
.style('fill', '#333')
.text("Age at Release");
legendTimeline.append("text")
.attr("class", "timelineLegend")
.attr("dy", height/2-bookRadius-5)
.attr("dx", 0)
.text("Age First Published, Died");
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment