Data And Process Visualisation For Graphic Communication A Handson Approach With Python 1st Edition Francesco Bianconi download
Data And Process Visualisation For Graphic Communication A Handson Approach With Python 1st Edition Francesco Bianconi download
https://ebookbell.com/product/data-and-process-visualisation-for-
graphic-communication-a-handson-approach-with-python-1st-edition-
francesco-bianconi-57213600
https://ebookbell.com/product/ultimate-pandas-for-data-manipulation-
and-visualization-efficiently-process-and-visualize-data-with-pythons-
most-popular-data-manipulation-library-tahera-firdose-57743098
https://ebookbell.com/product/ultimate-pandas-for-data-manipulation-
and-visualization-efficiently-process-and-visualize-data-with-pythons-
most-popular-data-manipulation-library-english-edition-1st-edition-
tahera-firdose-57725970
https://ebookbell.com/product/ultimate-pandas-for-data-manipulation-
and-visualization-efficiently-process-and-visualize-data-with-pythons-
most-popular-data-manipulation-library-english-edition-1st-
edition-57725974
https://ebookbell.com/product/robust-quality-powerful-integration-of-
data-science-and-process-engineering-jugulum-9954414
Ibm Infosphere A Platform For Big Data Governance And Process Data
Governance Sunil Soares
https://ebookbell.com/product/ibm-infosphere-a-platform-for-big-data-
governance-and-process-data-governance-sunil-soares-51348126
https://ebookbell.com/product/robust-quality-powerful-integration-of-
data-science-and-process-engineering-hardcover-rajesh-jugulum-7288354
https://ebookbell.com/product/privacy-and-data-protection-in-software-
services-services-and-business-process-reengineering-1st-
ed-2022-roberto-senigaglia-editor-33903782
Statistical Process Control And Data Analytics 8th Edition 8th Edition
John Oakland Robert Oakland
https://ebookbell.com/product/statistical-process-control-and-data-
analytics-8th-edition-8th-edition-john-oakland-robert-oakland-58376494
https://ebookbell.com/product/process-simulation-and-data-modeling-in-
solid-oral-drug-development-and-manufacture-1st-edition-marianthi-g-
ierapetritou-5353290
Francesco Bianconi
Data and
Process
Visualisation
for Graphic
Communication
A Hands-on Approach with Python
Data and
Process
Visualisation
for Graphic
Communication
Francesco Bianconi
Data and
Process
Visualisation
for Graphic
Communication
A Hands-on Approach with Python
Francesco Bianconi
Dipartimento di Ingeneria
Università degli Studi di Perugia
Perugia, Italy
© The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Switzerland
AG 2024
This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether
the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse
of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and
transmission or information storage and retrieval, electronic adaptation, computer software, or by similar
or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication
does not imply, even in the absence of a specific statement, that such names are exempt from the relevant
protective laws and regulations and therefore free for general use.
The publisher, the authors, and the editors are safe to assume that the advice and information in this book
are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or
the editors give a warranty, expressed or implied, with respect to the material contained herein or for any
errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
This Springer imprint is published by the registered company Springer Nature Switzerland AG
The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland
The book is divided into two parts: representing data (Part I) and representing
processes (Part II). The first part deals with the graphical representation of data. It
starts with an introductory chapter on the types of variables, then guides the reader
through the most common data visualization scenarios, i.e., representing magnitudes,
proportions, one variable as a function of the other, groups, relations, and bivariate,
trivariate, and geospatial data. The second part covers various tools for the visual
representation of processes; these include timelines, flow-charts, Gantt charts, and
PERT diagrams.
In both parts each graphic communication task is considered independently in a
separate chapter which contains:
vii
viii Preface
Companion Website
Prerequisites
out. Matthes’ crash course [1] is an excellent introduction to the language; Ramalho’s
Fluent Python [2] is a classic for those who want to take their skills to the next level.
Martelli et al.’s Python in a Nutshell [3] is also an amazingly deep yet accessible
desktop reference. For those who want to familiarize themselves with Pandas and
NumPy, McKinney’s Python for Data Analysis [4] is our recommendation.
Among the countless online resources we recommend Real Python [5], a platform
featuring tutorials, news, articles, and code examples for Python developers of all
levels.
Why Python?
At the time of writing Python is consistently ranked as the most popular programming
language in the world [6]. There are a number of reasons why it is so widely liked and
appreciated. Chief among them are its ease of use, its flexibility, and the presence
of an active and supportive community. The latter, in particular, is what makes it
possible to have tailored packages for nearly any kind of application in the most
disparate areas.
It is not uncommon to have a variety of Python packages for approaching the same
task, in which case the programmer will have to make a choice among the options
available. Graphic communication is no exception. As for data visualization, there
are already a number of packages available: Bokeh, HoloViz, Matplotlib, Plotly and
Seaborn are just some examples. In writing this book we therefore had to made a
choice about which package(s) to consider for the examples presented herein. We
initially decided to narrow the choice down to free tools only; consequently, paid
services such as PlotAPI are not discussed in this book. Then, for each type of chart
presented in the book, we proposed the implementation that we thought was the most
clear and concise. When there were substantially equivalent solutions, we favored
Matplotlib, both due to personal experience and the historical importance of this
library.
Our choice for the code was to keep all the Scripts self-contained and hence
separate from one another. The main advantage is that the reader can look at and
execute each script independently, without having to browse back and forth through
the book to find the missing parts. The downside, of course, is that there is some
code repetition: some parts (e.g., data loading and cleansing) are just copied and
pasted from one script to another. In a limited number of cases, when the difference
between two scripts was minor (by the order of two/three lines of code), we used
Code fragments to avoid excessive redundancy.
x Preface
Alternative Tools
As the title says, this book is tool-specific: our goal is not only to introduce the
reader to the theoretical aspects of graphic communication but also to provide
concrete solutions in Python, hence the “hands-on” in the title. There are, however,
many alternatives to Python including interactive, drag-and-drop tools as well as
other programming languages (see also [7] for an interesting discussion on this).
Microsoft Excel, Orange, Origin, and Tableau are examples of primarily in-
teractive solutions, although most of them also offer scripting capabilities. These
instruments typically have a low entry barrier, allowing anyone to quickly and eas-
ily create a bar or a line chart. That is particularly true when the usage is limited
to predefined template/models, but beyond that, customization and fine-tuning may
require some additional effort.
Among the programming languages JavaScript, MATLAB, and R are popular
alternatives to Python. Whichever the choice, the user will necessitate, in this case,
some background in coding and a comprehension of the different syntax and structure
(e.g., procedural vs. object.oriented) between the languages. There will probably be
a learning curve if you lack some background in coding; nonetheless, programming
languages usually provide significantly more flexibility and fine-tuning capabilities
than interactive tools.
Whether to favor interactive vs. code-based systems is essentially a matter of taste,
personal background, inclination, and not least the type of learner you are, whether
visual, reading/writing, kinaesthetic, or another type.
References
1. Matthes E (2022) Python crash course, 3rd edn. No Starch Press, San Francisco
2. Ramalho L (2022) Fluent Python. Clear, concise and effective programming,
2nd edn. O’Reilly Media, Sebastopol
3. Martelli A, Ravenscroft AM, Holden S, McGuire P (2023) Python in a nutshell,
4th edn. O’Reilly Media, Sebastopol
4. McKinney W (2022) Python for data analysis: data wrangling with pandas,
NumPy, and Jupyter, 3rd edn. O’Reilly Media, Sebastopol
5. Real Python. https://realpython.com/. Accessed 6 Dec 2022
6. TIOBE (The software quality company). TIOBE Index for January 2024. https://
www.tiobe.com/tiobe-index/. Accessed 8 Jan 2022
7. Schwabish J (2021) Better data visualizations. A guide for scholars, researchers
and wonks. Columbia University Press, New York
Acknowledgments
Every book has a story of its own and the people who encouraged and assisted the
authors along the way. This one is no exception. A conversation with my colleague
and friend Antonio Fernández (Universidade de Vigo, Spain) got me started in this
project: I wish to thank him for encouraging me from the very outset of this journey. I
would also like to express my gratitude to Fabrizio Smeraldi (Queen Mary, University
of London, United Kingdom) and Stefano Saetta (Università degli Studi di Perugia,
Italy) for their valuable remarks and suggestions. A special thanks to the assistant
editors at Springer and to Springer itself for giving me the opportunity to publish
this book. Finally, I am grateful to Helena Meadows for her continued support and
critical eye on my choice for the charts’ presentation—I thank her sincerely.
xi
Disclaimer
Any data used in this book from third-party sources, including national and interna-
tional agencies, governments, or other organizations, does not imply endorsement,
recommendation, or approval by any of these bodies of the book’s content.
xiii
Contents
Part I Data
1 Introducing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1 Types of Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Measures and Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Magnitudes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1 Bar Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.1 Basic Bar Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.2 Basic Bar Chart with Style Variations . . . . . . . . . . . . . . . . . . . 10
2.1.3 Paired Bar Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1.4 Stacked Bar Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.1.5 Multiple Bar Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.1.6 Horizontal Bar Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.2 Packed Bubble Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3 Proportions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.1 Pie Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.1.1 Basic Pie Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.1.2 Pie Chart With Side Legend . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.1.3 Pulling Out the Wedges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.2 Doughnut Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.3 Semi-Doughnut Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.4 Waffle Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.4.1 Multiple Waffle Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.5 Hundred Percent Stacked Bar Charts . . . . . . . . . . . . . . . . . . . . . . . . . . 40
xv
xvi Contents
5 Frequency Distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
5.1 Histogram Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
5.2 Dot Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.3 Pyramid Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
5.4 Area Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.4.1 Single Area Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.4.2 Multiple Area Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
6 Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
6.1 Strip Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
6.2 Swarm Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
6.3 Box Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.4 Combined Box and Strip Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
6.5 Violin Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
6.6 Combined Violin and Box Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
7 Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
7.1 Chord Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
7.1.1 Directed Chord Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
7.1.2 Undirected Chord Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
7.2 Sankey Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
7.2.1 One-to-Many Sankey Diagram . . . . . . . . . . . . . . . . . . . . . . . . . 98
7.2.2 Many-to-Many Sankey Diagram . . . . . . . . . . . . . . . . . . . . . . . . 101
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Contents xvii
11 Timelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
11.1 Horizontal timeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
11.2 Vertical Timeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
12 Flowcharts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
12.1 A Simple Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
12.1.1 Flowchart for Computing the Factorial of a Number . . . . . . . 171
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
C Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
C.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
C.1.1 Color Spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
C.2 Guidelines for Using Colors in Charts . . . . . . . . . . . . . . . . . . . . . . . . . 215
C.2.1 When to Use Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
C.2.2 When Not to Use Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
C.3 Color Palettes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
C.3.1 Sequential Color Palettes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
C.3.2 Diverging Color Palettes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
C.3.3 Qualitative Color Palettes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
C.4 Specifying Colors in Matplotlib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
C.4.1 Transparency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Part I
Data
Chapter 1
Introducing Data
The aim of this first chapter is to briefly introduce data. We explain the distinction
between quantitative and categorical variables as well as ordered vs. unordered
variables. Additionally, the notions of dimension and measure are also presented.
Data can be defined as pieces of information that can be collected, analyzed, and
used to gain knowledge and aid in decision-making. Concretely, data are collec-
tions of variables which represent any attribute or feature than can help distinguish
individuals, objects, or elements of any kind from one another [1].
As summarized in Fig. 1.1 variables come in different types. At the highest level
they can be classified into categorical and quantitative (the latter also referred to as
numerical in the remainder of the book).
Types of variables
Categorical Quantitative
Categorical variables answer the question "What type?" and the reply is always
a value from a finite set of predefined ones. Examples of categorical variables are
gender, country, province, nationality, make/brand, etc. If the set of predefined values
has only two elements the variable is said to be binary.
Quantitative variables answer the question "How much?" or "how many?" and can
be further categorized into discrete and continuous [2]. Discrete variables have values
in discrete sets, that is, sets where each element has a neighborhood containing only
that element (see also Appendix A.1 on this). Since discrete sets are either finite or
countably infinite [3], the natural way of generating discrete variables is by counting,
i.e., by recording how many times a certain event, element, or character occurs. A
continuous variable, by contrast, can take on an uncountable set of values: given
two values it is always possible to generate another value in between. Continuous
variables are generated by measurement.
Variables can also be ordered or not. We say that a variable is ordered when there
exists a total order on the set of all the possible values that the variable can take (more
about total and partial orders in Appendix A.1.1). We underline the fact that type of
variable (e.g., categorical vs. quantitative/numerical) and whether that a variable is
ordered or not are two distinct concepts. For example, it is a frequent assumption
that all univariate quantitative data are ordered. Though this is usually accurate, it is
not always the case. As an example consider color hue: albeit quantitative, this is not
an ordered variable (we cannot say that yellow is greater than green). We therefore
refer to ordered variables as the ones that possess a natural order, where natural
indicates some kind of intuitive, universally accepted ordering. None would object,
for instance, that height, weight, annual income, and pulse rate are ordered variables
in this sense. By contrast, we could sort some categorical variables such as gender
and nationality in alphabetical order, but this would be far from a natural ordering.
Besides, such an ordering would be language-dependent, hence arbitrary.
In the remainder of the book we shall denote variable types following the scheme
presented in Fig. 1.1. For the sake of simplicity we shall implicitly assume—unless
otherwise stated—that numerical variables are ordered and categorical ones are not.
Following the convention used in some data visualization tools (e.g., Tableau [4])
we consider data as composed of measures and dimensions.
• Measures represent quantities that can be measured or counted, and they are
usually expressed as numerical continuous or discrete variables. Samples of
measures are height, age, number of siblings, number of cars, etc.
• Dimensions are attributes that denote membership of a certain class/category,
and they are usually encoded as categorical or numerical discrete variables, e.g.,
country, region, year, month, etc. Dimensions are therefore variables that split
the measures into groups and subgroups determining the level of aggregation at
which the data are presented.
References 5
References
In this chapter we deal with the graphical representation of magnitudes over a set of
classes, where classes are identified by a categorical variable (e.g., country, province,
gender) or a numerical discrete one (e.g., year). We refer to a magnitude as the level
of some character of a class, and hence magnitudes are expressed as a numerical,
continuous, or discrete variable, for instance population, gross domestic product,
area, etc. The bar chart and its variations (paired bar charts, stacked bar charts)
are the mainstay in this context and are all presented in Sect. 2.1. Another option for
displaying magnitudes—packed bubble charts—is discussed in Sect. 2.2.
Bar charts are one of the most fundamental tools for data visualization. The main
objective of this kind of chart is to compare magnitudes across classes (inter-class
comparison), although they can also be used to display frequency distributions (this
case will be treated in Chap. 5).
A vertical bar chart (just bar chart henceforth) reports classes on the horizontal
axis and magnitudes on the vertical axis, whereas in a horizontal bar chart it is the
other way round. In both cases the length of the bars is proportional to the magnitude
represented. When bar charts are used for comparing magnitudes it is good practice
to sort the bars by length in descending order: tallest bar on the left in a vertical bar
chart and longest bar at the top in a horizontal one. To illustrate the use of bar charts
we shall consider the gross domestic product (GDP) of the G7 countries in 2010 and
2020 (Data listing 2.1).
Data listing 2.1: Gross domestic product of the G7 countries in 2010 and 2020
broken down by sector. Values are in billions of USD. (Source: The World Bank [1].
Available under Attribution 4.0 International (CC BY 4.0))
Country,Year,Total,Agriculture,Industry,Manufacturing,Services
Canada,2010,1617.3,24.3,427.0,161.7,1062.6
France,2010,2645.2,42.3,470.8,272.5,1870.2
...
Italy,2010,2136.1,38.4,467.8,303.3,1416.2
...
USA,2010,15049.0,150.5,2904.5,1790.8,11482.4
Canada,2020,1647.6,28.0,397.1,150.4,1115.4
France,2020,2639.0,42.2,435.4,246.0,1879.0
Germany,2020,3889.7,31.1,1034.7,635.7,2462.2
...
The bar chart in Fig. 2.1 displays the total GDP of the G7 countries in 2020 (Data
listing 2.1). In this type of plot we have one measure (GDP value) and one dimension
(country).
Fig. 2.1: Basic bar chart (Script 2.1). Measure: GDP (bar height), dimension: country
(x-axis tick labels)
2.1 Bar Charts 9
Script 2.1 shows how to generate the bar chart in Fig. 2.1. The proposed imple-
mentation is based on Matplotlib’s Axes.bar().
2 df = pd.read_csv(’data/gdp-g7-2010-2020.csv’, comment=’#’)
4 ax.bar(x=df[’Country’], height=df[’Total’])
1 Create a Figure with one sub-plot. Observe that, unless otherwise stated,
here and throughout the book we use Matplotlib’s explicit, object-
oriented interface (see Appendix B for details).
2 Read the GDP data.
3 Filter the data by year and sort by GDP in descending order.
4 Generate the bar chart. Arguments:
We now introduce some tweaks in the code to make the chart look a bit more stylish.
Concretely, we remove all the spines from the frame but the bottom one, add borders
to the bars, and display the GDP value at the top of each bar (Fig. 2.2). The solution
is presented in Script 2.2. The first and last part of the code are the same as in
Script 2.1; therefore we shall not comment on them further.
Fig. 2.2: Basic bar chart with style variations (Script 2.2). Measure: GDP (bar height),
dimension: country (x-axis tick labels)
Script 2.2: Basic bar chart with style variations (Fig. 2.2)
"""bar_chart_with_style_variations.py"""
import matplotlib.pyplot as plt
import pandas as pd
from mpl_ornaments.titles import set_title_and_subtitle
df = pd.read_csv(’data/gdp-g7-2010-2020.csv’, comment=’#’)
2 ax.bar_label(container=rects, padding=3)
fig.savefig(’charts/bar-chart-with-style-variations.png’, dpi=600,
bbox_inches=’tight’)
1 Generate the bar chart and store the returned value (instance of
matplotlib.container.BarContainer) for later use (see point 2 ). Ar-
guments (see Script 2.1 for those not mentioned here):
In Sects. 2.1.1–2.1.2 we have shown how basic bar charts can be used for inter-
class comparison of magnitudes. Paired bar charts enable both intra- and inter-class
comparisons. In this type of plot we have one measure and two dimensions: the bars
are grouped by position for the levels of the first dimension, while color and/or shade
denotes the second dimension.
The example in Fig. 2.3 is again based on the GDP data for the G7 countries (Data
listing 2.1). The purpose of this chart is to compare the GDP value by country in
2010 and 2020. In this case the GDP value is the measure; whereas country and year
respectively the first and second dimension.
12 2 Magnitudes
Fig. 2.3: Paired bar chart (Script 2.3). Measure: GDP (bar height and label), dimen-
sions: country (x-axis tick labels) and year (color)
Although the terms paired and grouped bar charts are used interchangeably in
practice, strictly speaking the first should be limited to those cases when the second
dimension is binary.
The implementation suggested in Script 2.3 has a relatively straightforward con-
cept: countries are represented by the x-axis ticks, and years by bars that are symmet-
rically positioned before and after each tick. To enhance readability we also include
horizontal grid lines, which is the visualization style recommended in [2].
This solution can be easily extended to sets of data where the second dimension is
non-binary (grouped bar charts). Keep in mind, however, that one potential problem
with grouped bar charts is clutter: too many bars can be confusing to the reader.
Therefore the use of this kind of chart with more than two bars per group should be
considered with care (see also [3, Chart types, paired bar] for a discussion on this).
2.1 Bar Charts 13
df = pd.read_csv(’data/gdp-g7-2010-2020.csv’, comment=’#’)
3 bar_width = 0.4
5 x_ticks_pos = np.arange(df[’Country’].nunique())
10 ax.set_xticks(ticks=x_ticks_pos)
ax.set_xticklabels(labels=countries_by_gdp)
11 ax.legend(title=’Year’)
Stacked bar charts are an extension of the basic bar chart (Sect. 2.1) in which the
bars are broken down into segments (stacks) that represent fractional components
of the main category. The segments are highlighted by color and/or shade for easy
differentiation. The total length of each bar is the sum of the length of each segment;
therefore stacked bar charts are particularly useful to highlight the relative weight
of the categories within each bar [3]. Just like in paired bar charts, we have one
measure and two dimensions: in this case the first dimension usually denotes the
main category, and the second dimension a sub-category of the main one. Therefore
the first dimension differentiates one bar from another, the second dimension one
segment from another (within the same bar).
The example in Fig. 2.4 shows the GDP of the G7 countries broken down by
sector, i.e., agriculture, industry, manufacturing, and services. In this chart GDP is
the measure, country the first dimension, and economic sector the second dimension.
2.1 Bar Charts 15
Fig. 2.4: Stacked bar chart (Script 2.4). Measure: GDP (bar and stack height),
dimensions: country (x-axis tick labels) and sector (color)
One solution to generate this plot is to think of each group of GDP segments as
a separate bar chart sharing the same x- and y-axes with the other groups. We can
do this by repeatedly calling Matplotlib’s Axes.bar() and leveraging on the bottom
argument to adjust the vertical position of the bottom line (baseline) of each segment.
The implementation is described in Script 2.4.
df = pd.read_csv(’data/gdp-g7-2010-2020.csv’, comment=’#’)
2 bottom = np.zeros(df[’Country’].nunique())
16 2 Magnitudes
ax.legend(title=’Sector’)
A multiple bar chart is conceptually equivalent to a stacked bar chart except the
segments making up each bar are pulled apart and placed into separate plots (Fig. 2.5).
The plots are arranged into a vertical array and the categories of the first dimension
2.1 Bar Charts 17
are maintained aligned. This layout facilitates the comparison of values across the
categories of the second dimension, in this case the GDP sector. More generally,
the approach of subdividing a chart into smaller sub-plots is referred to as small
multiples [3] and will be used in other parts of the book.
Fig. 2.5: Multiple bar chart (Script 2.5). Measure: GDP (bar height), dimensions:
country (x-axis tick labels) and sector (sub-plot + sub-plot label and color)
In the solution presented in Script 2.5 we first generate the sub-plots as place-
holders for the bar charts, then again use Axes.bar() to draw the bars.
Script 2.5: Multiple bar chart (Fig. 2.5)
"""multiple_bar_chart.py"""
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from mpl_ornaments.titles import set_title_and_subtitle
df = pd.read_csv(’data/gdp-g7-2010-2020.csv’, comment=’#’)
1 grid_spec = {’hspace’:0.5}
fig, axes = plt.subplots(nrows=len(gdp_sectors), ncols=1,
gridspec_kw=grid_spec)
3 max_val = df[gdp_sectors].max().max()
7 ax.set_ylim([0,max_val])
8 ax.bar_label(container=rects, padding=3)
10 for ax in axes.flatten()[:-1]:
ax.set_xticklabels([])
1 Create one sub-plot for each GDP sector (see comments to Script B.3
for the meaning of grid_spec).
2 Define a qualitative color palette with as many colors as GDP sectors
(see also Appendices B–C for a discussion on color palettes and how to
define colors in Matplotlib).
3 Store the maximum value by GDP sector and country for uniform scaling
of the y axis (see point 6 ).
4 Zip sub-plots, GDP sectors, and colors into one iterable.
5 Iterate through the GDP sectors.
6 Draw the bar plot for the current GDP sector.
7 Adjust the y-axis scaling.
8 Show the GDP values at the top of the bars.
2.1 Bar Charts 19
10 Remove the tick labels from all the sub-plots except from the bottom
one.
Horizontal bar charts are simply vertical bar charts rotated by 90.◦ . There is no
conceptual difference between the two types of chart, except the horizontal ones are
preferable when the levels of the first dimension imply long category names. The
reason is that there is more room on the left-hand side of the chart to accommodate
the category labels [2, 4]. The horizontal bar chart in Fig. 2.6 is the rotated version
of the vertical bar chart presented in Fig. 2.1.
Matplotlib’s Axes.barh() enables easy generation of horizontal bar charts, as
shown in Script 2.6. Note that most parts of the code have already been explained in
the previous examples; therefore we shall not comment on them further.
Script 2.6: Horizontal bar chart (Fig. 2.6)
"""horizontal_bar_chart.py"""
import matplotlib.pyplot as plt
import pandas as pd
from mpl_ornaments.titles import set_title_and_subtitle
df = pd.read_csv(’data/gdp-g7-2010-2020.csv’, comment=’#’)
df = df[df[’Year’] == (year := 2020)]
2 ax.barh(y=df[’Country’], width=df[’Total’])
fig.savefig(’charts/horizontal-bar-chart.png’, dpi=600,
bbox_inches=’tight’)
1 Sort the GDP values in ascending order so as to have the longest bar at
the top of the chart.
2 Create the horizontal bar chart. Arguments:
Fig. 2.6: Horizontal bar chart (Script 2.6). Measure: GDP (bar length), dimension:
country (y-axis tick labels)
2.2 Packed Bubble Chart 21
Packed bubble charts are another technique for comparing and visualizing magni-
tudes across levels of a dimension that is often represented by a categorical (usually
non-binary) variable. This kind of plot is composed of a set of circles (bubbles), one
for each category. The area of each circle is proportional to the value of the variable
to represent (measure), while color and label denote the category (dimension). The
plot is arranged in such a way that no two circles overlap, and some (or all) of them
are mutually tangent (hence the term ‘packed’).
The example in Fig. 2.7 shows how to use a packed bubble chart again to display
the GDP of the G7 countries in 2020 (Data listing 2.1). Note that the overall spatial
layout of the circles is irrelevant: we can change the relative position of two or more
circles without altering the information content of the chart.
Fig. 2.7: Packed bubble chart (Script 2.7). Measure: GDP (bubble area and label),
dimension: country (bubble color and label)
df = pd.read_csv(’data/gdp-g7-2010-2020.csv’, comment=’#’)
df = df[df[’Year’] == (year := 2020)]
df.sort_values(by=’Total’, inplace=True, ascending=False)
3 cpalette = colormaps[’Set3’].resampled(lutsize=df[’Country’].nunique())
6 bubble_chart.collapse()
7 bubble_chart.plot(ax=ax, labels=df[’Labels’].to_list(),
colors=colour_codes)
8 ax.set_axis_off()
9 ax.autoscale_view()
fig.savefig(’charts/packed-bubble-chart.png’, dpi=600,
bbox_inches=’tight’)
References
1. The World Bank (2023) World Development Indicators: Structure of value added.
Available Online at http://wdi.worldbank.org/table/4.2. Last Updated on 26 Oc-
tober 2023. Accessed 11 November 2023
2. Wilke CO (2019) Fundamentals of data visualization. Aprimer on making infor-
mative and compelling figures. 1st edn. O’Reilly Media, Sebastopol
3. Schwabish J (2021) Better data visualizations. A guide for scholars, researchers
and wonks. Columbia University Press, New York
4. Esselman A (2022) Which bar chart orientation should I use? In Storytelling with
data/You asked. Available Online at https://www.storytellingwithdata.com/blog/
2022/1/21/which-bar-orientation-should-i-use. Accessed 16 December 2023
5. Hunter J, Dale D, Firing E, Droettboom M, The Matplotlib development team.
Packed-bubble chart. Available Online at https://matplotlib.org/stable/gallery/
misc/packed_bubbles.html. Accessed 11 November 2022
Chapter 3
Proportions
The topic of this chapter is the visualization of proportions, that is, part-to-whole
relationships. We are therefore in the situation where the data can be partitioned
into a set of classes, for instance gender, nationality, age group, etc. The classes
are usually expressed as a categorical variable; the proportion values are expressed
as continuous variables with values in .[0, 1] or, equivalently, as percentages, with
the constraint that they sum to 1 (or 100%). In this type of chart we therefore have
one measure (representing a fraction or percentage) and usually one (occasionally
more) dimension. The general goal is to emphasize the relative importance of the
categories while also bringing the reader’s attention to each category’s portion of
the total. We present different tools for visualizing proportions; these include pie
charts, doughnut charts, waffle charts, hundred percent stacked bar charts, hundred
percent divergent stacked bar charts, and tree maps.
Pie charts are one of the most popular types of plot for representing proportions.
A pie chart is a circle partitioned into radial slices (wedges) where each wedge
represents one class (Figs. 3.2, 3.3, 3.4). The arc length (hence the central angle
and area) of each wedge is proportional to the share of the corresponding class,
while color denotes category. Scottish statistician William Playfair is credited for
introducing pie charts for the first time at the beginning of the nineteenth century.
Figure 3.1 shows an early pie chart from Playfair’s Statistical Breviary [1].
In the following examples we show how to generate pie charts of the age dis-
tribution in the United States in 2022 (Data listing 3.1). In this situation we have
one measure (the proportion of each age group as a fraction of the total) and one
dimension, the age group (each age group represents one class).
Fig. 3.1: Sample of an early pie chart from Playfair’s Statistical Breviary. (Source:
Wikimedia Commons [2], public domain)
Data listing 3.1: Age distribution in the United States, 2022. Population values are
in thousands, age groups in years. (Source: US Census Bureau [3], public domain.
Age groups modified from the original)
Age_group,Population
0-4,18539
5-14,41459
15-24,42266
25-34,44583
35-44,43190
45-54,40130
55-64,42178
65+,56193
Figure 3.2 shows an example of a pie chart based on the data reported in Data
listing 3.1. The implementation proposed in Script 3.1 relies on Matplotlib’s Axes.
pie().
3.1 Pie Charts 27
Fig. 3.2: Basic pie chart (Script 3.1). Measure: proportion (wedge area and label),
dimension: age group (color and label)
1 df = pd.read_csv(’data/age-distribution-usa-2022.csv’, comment=’#’)
df[’Percentage’] = 100*df[’Population’]/df[’Population’].sum()
4 ax.pie(x=df[’Population’], labels=df[’labels’].to_list(),
wedgeprops=wedgeprops, textprops=textprops, labeldistance=1.18)
1 Load the data and compute the percentage of each age group.
2 Generate the labels to show by each wedge.
3 Pack the style settings for the labels and wedges:
– textprops = {’ha’:’center’, ’va’:’center’} → Center the text
vertically and horizontally.
– wedgeprops= {’linewidth’:1.5, ’edgecolor’:’white’} .→ The
width and color of the wedge borders.
4 Create the pie chart. Arguments:
– x=df[’Population’] .→ The size of the wedges
– labels=df[’Age_group’] .→ The wedge labels
– wedgeprops=wedgeprops, textprops=textprops → The wedge style
– labeldistance=1.18 .→ The radial distance of the labels from the
center of the pie
We now consider a variation of the pie chart presented in Sect. 3.1.1 in which the
labels are no longer displayed by the wedges but in a side legend (Fig. 3.3). The
procedure is exemplified in Script 3.2. Note that the first part of the code is the same
as in Script 3.1, and therefore it is not commented on further.
Script 3.2: Pie chart with side legend (Fig. 3.3)
"""pie_chart_side_legend.py"""
import matplotlib.pyplot as plt
import pandas as pd
from mpl_ornaments.titles import set_title_and_subtitle
df = pd.read_csv(’data/age-distribution-usa-2022.csv’, comment=’#’)
df[’Percentage’] = 100*df[’Population’]/df[’Population’].sum()
df[’labels’] = (df[’Age_group’] + ’ ’ +
df[’Percentage’].map(’({:3.1f}%)’.format))
fig.savefig(’charts/pie-chart-side-legend.png’, dpi=600,
bbox_inches=’tight’)
1 Create the pie chart. Proceed as in Script 3.1, but pass labels=None to
prevent the labels from being shown by the wedges.
2 Add the legend. Arguments:
Fig. 3.3: Pie chart with side legend (Script 3.2). Measure: proportion (wedge area),
dimension: age group (color)
30 3 Proportions
We can easily pull out one or more wedges from a pie chart by leveraging on the
explode parameter of Axes.pie(). This iterable specifies the extent by which each
wedge is moved away from the center of the chart in a radial direction. The values
are given as a fraction of the radius.
In Fig. 3.2 we pull the wedges of the last three age groups out of the pie. To
this end we modify Script 3.1 as shown in Script 3.3. Again, we refer the reader to
Script 3.1 for the parts of the code not commented on here.
Fig. 3.4: Pulling out the wedges (Script 3.1). Measure: proportion (wedge area and
label), dimension: age group (color and label)
df = pd.read_csv(’data/age-distribution-usa-2022.csv’, comment=’#’)
df[’Percentage’] = 100*df[’Population’]/df[’Population’].sum()
3.2 Doughnut Charts 31
labels = list()
for _, row in df.iterrows():
labels.append(f’{row["Age_group"]}\n({row["Percentage"]:3.1f}%)’)
1 offsets = np.zeros(len(labels));
offsets[-3::] = 0.05
fig.savefig(’charts/pie-chart-exploded.png’, dpi=600,
bbox_inches=’tight’)
1 Define the amount of the offset for each of the wedges we want to pull
out. Offset values are expressed as a fraction of the pie radius.
2 Create the pie chart and use the explode argument to pull out the last
three wedges by the amount defined in 1 .
Doughnut charts are a graphical variation of pie charts with the main difference that
the overall shape is a ring instead of a circle (Fig. 3.5).
A small tweak to point 3 of Script 3.1 makes it very simple to create a doughnut
chart as shown in Code fragment 3.1. The key argument is ’width’:0.3 passed to
Matplotlib’s Axes.pie(), the effect of which is to set the radial width of the wedges
to 0.3, i.e., 30% of the pie radius.
Fig. 3.5: Doughnut chart (Script 3.1 as modified by Code fragment 3.1). Measure:
proportion, dimension: age group
Semi-doughnut charts are essentially doughnut charts with half of the circle chopped
off. The original doughnut is usually cut in half horizontally, with the top half being
retained. This kind of plot is very common for representing the composition of
parliaments. In the following example we indeed consider the composition of the
House of Commons (United Kingdom) in 2022 (Fig. 3.6); the source data are shown
in Data listing 3.2.
Data listing 3.2: Composition of the House of Commons, United Kingdom, 2022.
Key to fields: Party = name of the political party; Abbreviation = abbreviation
by which the party is identified; Colour: color used for representing the party (see
also Appendix C). (Source: UK Parliament [4]. Contains Parliamentary information
licensed under the Open Parliament Licence v3.0. Colors added by the authors)
Party,Abbreviation,Seats,Colour
Conservative,CON,356,royalblue
Labour,LAB,196,red
Scottish National Party,SNP,44,yellow
Liberal Democrat,LD,14,orange
Others,Others,40,grey
Total,TOT,650,black
3.3 Semi-Doughnut Charts 33
Fig. 3.6: Semi-doughnut chart (Script 3.4). Measure: number of seats, dimension:
political party
1 df = pd.read_csv(’data/uk-house-of-commons-2022.csv’, comment=’#’)
4 wedges[-1].set_visible(False); text[-1].set_visible(False)
5 df = df[df[’Party’] != ’Total’]
legend = fig.legend(labels=df[’Party’], loc=’center’,
bbox_to_anchor=(0.5, 0.35), ncol=3, frameon=False)
fig.savefig(’charts/semi-doughnut-chart.png’, dpi=600,
bbox_inches=’tight’)
A waffle chart, sometimes called a square pie or grid plot [5], is made up of a grid
of square or rectangular cells. Each cell in the grid represents a certain percentage
of the total data, while the grid as a whole represents the full data. Color and/or
shade indicates category, and categories are represented by clusters of contiguous
cells with the same fill. The number of cells in each cluster is proportional to the
share of that category to the whole. For easy understanding it is recommended to
select the total size of the grid to be a simple number (100 cells is a typical value).
The example in Fig. 3.7 again shows the distribution of the US population by age
group in 2022 (Data listing 3.1).
Observe that the discrete nature of this type of representation requires translating
the original data into a set of natural numbers (the number of cells of each class)
while maintaining the proportions among the classes similar to that of the original
data. This process is known as apportionment [6].
At the implementation level a waffle chart can be thought of as a variation of a heat
map (more on this in Sect. 9.3) with the following distinctive features: a) the color
palette is qualitative, b) color denotes classes, and c) cells denoting the same class
are contiguous. The solution presented in Script 3.5 relies on seaborn.heatmap(),
3.4 Waffle Charts 35
Fig. 3.7: Waffle chart (Script 3.5). Measure: proportion (number of squares of each
cluster; one square .≈1%), dimension: age group (color)
Seaborn’s [7] method for generating heat maps. For the apportionment we use
Voting [8], a Python library for election quotas, voting measures, and apportionment
methods.
df = pd.read_csv(’data/age-distribution-usa-2022.csv’, comment=’#’)
df[’Percentage’] = 100*df[’Population’]/df[’Population’].sum()
df[’Labels’] = (df[’Age_group’] + ’ ’ +
df[’Percentage’].map(’({:3.1f}%)’.format))
1 cmap = mpl.colormaps[’tab10’].resampled(df.shape[0])
36 3 Proportions
2 grid = np.zeros(shape=(10,10))
4 grid_data = []
for idx in df.index:
grid_data.extend([idx]*df.iloc[idx][’Apportionement’])
grid = np.array(grid_data).reshape(grid.shape)
6 ax.set_axis_off()
7 ax.set_aspect(’equal’)
– cmap=cmap → The color map that defines the mapping from values
to color space.
– cbar=False .→ Do not draw a color bar.
Please refer to the remarks on Scripts 3.1 and 3.2 for the parts of the code
not commented on here (particularly data reading and legend placement).
Fig. 3.8: Multiple waffle chart (Script 3.6). Measure: proportion of tertiary-educated
people (number of dark squares in each waffle; one square .≈1%), dimensions: being
tertiary-educated, yes or no (color), and country (waffle title)
Random documents with unrelated
content Scribd suggests to you:
heart without some strong doubt of the sincerity of the person he
has been conversing with.
Sir Arthur Adelon, after leaving Eda and Dudley together, hurried
back as fast as he could go to the house of Mr. Clive, passing by the
way the man who had brought him the note, which he still held
clasped firmly in his hand. He was evidently a good deal agitated
when he set out; the muscles of his face worked, his brow
contracted, and muttered sentences escaped his lips. From this state
he seemed to fall into deep thought. The emotions probably were
not less intense, but they were more profound; and when he came
near the house he stopped and leaned for a moment against the
gate, murmuring, "What can it be?" After a pause of a moment or
two he rang the bell, and asked the maid who appeared, where the
gentleman was who had sent him that letter. The woman seemed
somewhat confused, said she did not know anybody had sent him a
letter, but that Mr. Clive was in the drawing-room with his daughter.
Her embarrassment, and that of the baronet, however, were
removed, almost as she spoke the last words, by a voice calling
down the stairs and saying, "Sir Arthur Adelon, will you do me the
honour of walking up hither?"
The baronet instantly obeyed the invitation, but it was with a very
pale face, and the next instant he was in the room with Norries. The
latter had withdrawn into the chamber where his conference had
taken place with Clive, and he fixed a steadfast gaze on the baronet
as he entered; then turning towards the door, he closed it and
waved his visitor to a seat, taking one himself at the same time, and
still keeping his bright gray eyes fixed firmly upon the baronet's face.
Hitherto not a word had been spoken, and Norries remained silent
for some instants; but at length he said, "I perceive, both by your
coming and your demeanour, Sir Arthur Adelon, that you have not
forgotten me."
"Oh, no! Mr. Norries," replied the baronet; "I remember you quite
well, and am happy to see you. But is it not somewhat dangerous
for you to visit England just now?"
"Not in the least, I think," said Norries. "I am obliged to you for
your solicitude, Sir Arthur. If it had shown itself materially twelve
months ago, it might have kept me out of York Castle."
"I really do not see how I could have served you," answered Sir
Arthur Adelon; "indeed, I never knew that you were in York Castle."
"Pardon me, Sir Arthur," replied Norries; "I never told you any
such thing. My partner did, but he lied in this case as in many
others, and I, who knew little of the transaction at the time, found
the papers after his death, and have them safe in my possession."
There was some writing paper lying on the table, clean and
unsullied; but without knowing what he did, Sir Arthur Adelon took it
in his hands, and in two minutes it was twisted into every
conceivable shape. Norries gazed at him with the slightest possible
smile; and in the end he said, "I am afraid, Sir Arthur, that paper will
not be very serviceable; however, we can get more."
"Paha!" cried Sir Arthur Adelon; "let us think of serious things, Mr.
Norries. Those letters must be destroyed. Do you mean to say they
were all preserved?"
"No, sir, I did not," exclaimed Sir Arthur, catching at the last word.
"Yes, Sir Arthur, you did," replied Norries, firmly; "or you never
would have employed him in so rascally a business."
The face of Sir Arthur Adelon flushed. He was a man of one sort
of courage, and he replied, haughtily, "I think you intend to insult
me, sir. Beware what you are doing."
"True," replied Norries; "there are some things in law which have
no remedy, as I do well know; but it is right that the son should
learn who ruined his father, and he should have known long ago, but
for one circumstance which may perhaps operate still farther."
"No one told me," answered Norries; "I knew it. I might have
read it in every line of those letters; I might have seen it in every
deed you did; but there was a portion of your previous history, Sir
Arthur, which I knew from my connexion with that part of the
country, and which when once the machinations were exposed to my
view, afforded the key to all. I ask you, Sir Arthur Adelon, whether
some six or seven-and-twenty years ago, Mr. Charles Dudley did not
carry off from your pursuit, the lady on whom you had fixed your
heart?"
"Well, Sir Arthur," continued Norries, with a softened air, "I can
excuse strong passions, for I have them myself, and I know them at
times to be irresistible. In your case, I was sure you had been thus
moved. I looked upon you as a man devoted to the service of your
country; and I thought that, in a case where all other considerations
should give place to the interests of my country, it would be wrong
to damn for ever the name of one who might do her the best and
highest of services. There was but one thing that made me doubt
your sincerity."
"You should not doubt it," said Sir Arthur; "I am as sincerely
devoted to the service of my country as ever."
"Speak plainly," said Sir Arthur Adelon. "What is it that you want?"
A bitter smile came upon the lip of his companion; but he replied
immediately, "Even so! I would, indeed, Sir Arthur. The spirit of
patriotism is not so strong in you, it would seem, as the spirit of
revenge, or you would not hesitate. But thus much, to end all, one
way or the other: you either come, and, if you do come and frankly
join us, without any insincerity, receive the papers I have mentioned;
or you stay away, and Mr. Edward Dudley receives them."
"But it may be very difficult to manage," said Sir Arthur Adelon; "I
have guests in my house, whom I cannot in courtesy leave without
some exceedingly good excuse. I am not accustomed to go out at
such hours of the night, and to do so will certainly appear very
suspicious, especially under existing circumstances."
"Nor can I bind myself to anything, then, till I hear upon what you
do decide," rejoined Norries. "The papers are yours whenever you
act up to your professions. I shall ask nothing more, Sir Arthur. I
have a copy of your speech upon an occasion which you well
remember; I will require nothing more of you than to fulfil the
pledges therein given, and the moment you prove you are ready so
to act, I resign into your hands those letters, of which others might
not judge so favourably as I am inclined to judge. Do you promise to
come?"
"I do," answered Sir Arthur Adelon, in a firmer tone than he had
hitherto used, but with a certain degree of bitterness too. "Yet,
Norries, there are various other thoughts and considerations of deep
moment, which our conversation of to-day suggests. It revives in me
the memories and feelings of past years. You should have
considered that these matters had passed away from my mind for a
long time; that of the plans, and hopes, and schemes, and passions
of those times, some have been accomplished or gratified, and have
been well nigh forgotten; some, from the utter hopelessness of
seeing them accomplished, have faded away, and become more like
a vision than a reality. What will not a man do when he is eager and
excited with the vehement impulse of fresh feelings and sharp
discussions, and the enthusiasm of those who surround him? But
take those accessories away, and the purposes themselves fall into a
sleep from which it requires some time and preparation to arouse
them into active and energetic being again. You should have
considered this, and not pressed me so eagerly without some
preparation."
Sir Arthur Adelon, while the other spoke, had cast down his eyes
thoughtfully, as if little attending to the words of his companion; but
when he ceased speaking, he said, in an abstracted manner, "This
Dudley, too, he has intruded himself into my family. He is now at
Brandon, as you have doubtless heard. The cold, icy hand seemed to
seize my heart again when I saw him. I felt as if the spawn of the
viper were before me, and as if it were destined that the race were
to survive and poison my peace, even when the reptile that first
stung me was crushed."
"I can see that, Sir Arthur Adelon," answered his companion; "and
I see, moreover, a dark and sinister fire in your eyes, which I
observed once before, when first in my presence you mentioned the
name of Mr. Dudley to my partner. There were deeds followed that
mention, which I need not call to your mind. I trust there will be
none such now--nay, nor any attempt towards them; if there be, I
will prevent it. I am not so good a lawyer--indeed, I know but little
of the trade--I am not so good a lawyer as Mr. Sherborne, but I am a
bolder, more resolute, and more honest man. However, I shall see
you to-night. Is it not so?"
"Undoubtedly," answered Sir Arthur Adelon; "but you have not yet
told me where I shall find you in Barhampton."
CHAPTER IX.
Mr. Filmer, however, had his own particular views, which led him
upon one peculiar course. His very position gave a direction to all his
actions. The Roman priest stands alone amidst the world, separated
from all the dearest ties of our nature by an irremovable barrier. He
may have sympathies, but they are curtailed and restricted; he may
have affections, but they are limited and enthralled. One
predominant object is ever before him: one career is fixed for his
efforts. He stands alone in the world, I repeat, not so much the
servant of God as the servant of a hierarchy, to the interest and
advancement of which all his energies must be devoted, and for
whose purposes all his talents must be employed. As long as he can
bring the satisfaction of affections, and the gratification of any
passions, within the circle to which the whole course of education
from his earliest years has restricted his consciousness of duty,
perhaps they may be more strongly--I had almost said more fiercely-
-exercised, from the very fact of their narrow range; but the moment
they would go beyond that limit, the petrifying influence of an
engrossing church comes in, and changes the man into the mere
representation of a system.
The dinner passed most cheerfully with all but Sir Arthur Adelon.
Lord Hadley was in great spirits; and, seated next Eda, he made
himself as agreeable as moderate talents, gentlemanly manners, and
no very decided character would admit. Dudley was calm, by no
means so gay as his young companion; but yet the happiness that
was in his heart, like a lamp within an alabaster urn, spread light
and cheerfulness over all. Mr. Filmer was, as usual, composed and
tranquil in his manner; at times impressive in his language, but often
adding to the gaiety of others by a quiet jest or epigrammatic reply,
which derived additional force from his seeming unconscious of its
possessing any. Eda left the table very soon after the dessert had
appeared. There were those things in her bosom which made her
feel happy in the solitude of her own chamber. Thought, calm,
uninterrupted thought, was at that moment very sweet to her. She
loved and was beloved; and she had the grand satisfaction of feeling
that she had it in her power to raise one to whom her affections had
been given for years, who possessed her highest esteem, and who
she knew well deserved high station, from unmerited misfortunes to
the position which he was born to ornament. It was indeed a
blessing, and Eda went and pondered upon it till her eyes filled with
pleasant tears.
For about a quarter of an hour after she had gone, Sir Arthur
Adelon continued at the table, passing the wine with somewhat
nervous haste, and keeping up a broken conversation from which his
thoughts were often absent. At length he said, speaking across the
table, "Filmer, my reverend friend, I wish to speak with you for a few
minutes: Lord Hadley, Mr. Dudley, you must not suffer the wine to
stand while we are absent; I shall be back almost immediately." And
he led the way out of the room.
"Well, Filmer," said the baronet, almost before the door was
closed, "I have something to talk to you about of great importance."
"I thought so, Sir Arthur," answered Mr. Filmer. "What is it?"
"Why did you think so?" inquired his friend, somewhat surprised,
and somewhat apprehensive.
"No," answered Mr. Filmer, drily; "but we knew that last night. I
certainly did, from the moment I saw the back of his head, and your
face left no doubt that you had made the same discovery."
"The very first sight of him," answered Sir Arthur Adelon, bitterly,
"and the feelings which that sight produced, left me no doubt of who
it was that stood before me. But listen a moment, Filmer--listen a
moment. There is much more behind. You remember well that
business of Charles Dudley, I say, of him who was my friend and
companion, my rival and my enemy, and last, my acquaintance----"
"Yes; but my dear friend," replied Sir Arthur Adelon, "those papers
are of much importance, let me tell you. Both your character and
mine are compromised if they should ever see the light----"
"But you told me they were burned," said Mr. Filmer, with a
countenance less firm and tranquil than usual.
This was, as the reader knows, substantially true; for Sir Arthur
Adelon was one of those men who do not like to tell a direct
falsehood, even when it is their intention to deceive; and he
intended his words to convey to the mind of the priest a very
different impression of Norries' intentions, while he could always fall
back upon the precise terms he had employed, and put a larger
interpretation upon them than Mr. Filmer was likely to do at the
moment.
"But his son is living," replied the baronet, quickly, impatient that
his companion did not see the importance of the documents at once-
-"his son is living; Norries knows that he is here, and he threatens to
place the whole of the papers in his hands."
"Oh! no," replied the priest; "I have not forgotten, Sir Arthur, and
I say it would be unpleasant, very unpleasant. What does this
person Norries ask for the papers?"
"Oh! a great deal," answered Sir Arthur Adelon, still speaking with
that sort of mental reservation which he had learned betimes; "more
than I am inclined to grant: a great deal more; but I shall see him
to-night. I have an appointment with him at Barhampton, and shall
there learn what is the real extent of his demand."
"But what has all this to do with the question?" exclaimed Sir
Arthur Adelon, not comprehending what the reader has perhaps
perceived, that the priest was carrying on in words one train of
reasoning, very loosely connected with the immediate subject, while
in thought he was revolving more pertinently all the difficult points
that were before him.
"What! would you have me, then, join with him now?" exclaimed
Sir Arthur, in considerable surprise; for the arguments of Father
Peter went so directly to support the inducements held out by
Norries, that the baronet could hardly persuade himself there had
not been some communication between the Chartist and the priest.
"I did not exactly say that," answered Filmer. "Men's views
frequently undergo a change in a few years. I know not what this
man's opinions may now be. He was then an eager advocate for
perfect freedom of religious opinions; he was then for sweeping
away altogether what they call here the Church of the State, and
leaving every man to follow what creed he thinks best."
The priest smiled with one of those calm, sagacious smiles that
have a certain though moderate portion of triumph in them, the
triumph of superior astuteness. "I would support them for their
hour," he said. "I remember hearing of a wise stratagem practised
by a great general who was besieging a refractory city. The
inhabitants had dammed up a river which ran on one side of the
town, and thus had defended their walls on that side from all attack.
The dam or barrier which they had constructed was immediately
under the fire of one of their strongest works, so that it was
unassailable; but the general of whom I speak, by a week's hard
labour, turned the course of a still larger river into that which served
for their defence, and the mighty torrent, rushing down, swept away
the barriers altogether. The river resumed its equal flow, and the
attacking army, marching on, took the town by storm on the very
side where it had been judged impregnable. Now, my dear friend,
the Catholic religion is the attacking army; the revolted and besieged
city is this country of England; the overflowed river which defends us
is moderate toleration of opinion; the barrier which keeps the waters
up is the heretical church of this country, and we have nought to do
but to pour the torrent of licentious freedom against that barrier till
it is quite overthrown, in order to have a clear way for our march,
and to secure our ultimate triumph."
"I do not think he would open his views before another," said Sir
Arthur, hastily; "but as it is well, my reverend friend, to be prepared
against the worst, let us consider what must be done should this
man's views be very exorbitant, and should he refuse all time for
deliberation."
"Then you must say 'No,' of course," replied Filmer; "and we will
take measures against his measures."
"I see none that we can take," answered the baronet, gloomily.
"He would instantly place the papers in this young man's hands, and
then ruin, and destruction, and disgrace, would be the
consequence."
ebookbell.com