0% found this document useful (0 votes)
14 views

Python Data Visualization Cookbook 2nd Edition Igor Milovanovic pdf download

The 'Python Data Visualization Cookbook, 2nd Edition' by Igor Milovanovic and others provides over 70 recipes to help users create visualizations using popular Python libraries. It covers data preparation, various plotting techniques, and advanced visualizations, including 3D and cloud-based options. This book is aimed at developers and data scientists looking to enhance their data visualization skills in Python.

Uploaded by

simthmhaydo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Python Data Visualization Cookbook 2nd Edition Igor Milovanovic pdf download

The 'Python Data Visualization Cookbook, 2nd Edition' by Igor Milovanovic and others provides over 70 recipes to help users create visualizations using popular Python libraries. It covers data preparation, various plotting techniques, and advanced visualizations, including 3D and cloud-based options. This book is aimed at developers and data scientists looking to enhance their data visualization skills in Python.

Uploaded by

simthmhaydo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Python Data Visualization Cookbook 2nd Edition

Igor Milovanovic download

https://ebookultra.com/download/python-data-visualization-
cookbook-2nd-edition-igor-milovanovic/

Explore and download more ebooks or textbooks


at ebookultra.com
We believe these products will be a great fit for you. Click
the link to download now, or visit ebookultra.com
to discover even more!

Python data science cookbook over 60 practical recipes to


help you explore Python and its robust data science
capabilities Subramanian
https://ebookultra.com/download/python-data-science-cookbook-
over-60-practical-recipes-to-help-you-explore-python-and-its-robust-
data-science-capabilities-subramanian/

Python cookbook Third Edition Beazley

https://ebookultra.com/download/python-cookbook-third-edition-beazley/

Python Cookbook 1st Edition Alex Martelli

https://ebookultra.com/download/python-cookbook-1st-edition-alex-
martelli/

Python Cookbook 3rd Edition David Beazley

https://ebookultra.com/download/python-cookbook-3rd-edition-david-
beazley/
Python cookbook 3ed. Edition Beazley D.

https://ebookultra.com/download/python-cookbook-3ed-edition-beazley-d/

IPython Interactive Computing and Visualization Cookbook


1st Edition Cyrille Rossant

https://ebookultra.com/download/ipython-interactive-computing-and-
visualization-cookbook-1st-edition-cyrille-rossant/

Data Visualization with D3 and AngularJS 1st Edition


Korner

https://ebookultra.com/download/data-visualization-with-d3-and-
angularjs-1st-edition-korner/

Maya Programming with Python Cookbook 1st Edition Herbez

https://ebookultra.com/download/maya-programming-with-python-
cookbook-1st-edition-herbez/

Data Driven SEO with Python Solve SEO Challenges with Data
Science Using Python 4th Edition Andreas Voniatis

https://ebookultra.com/download/data-driven-seo-with-python-solve-seo-
challenges-with-data-science-using-python-4th-edition-andreas-
voniatis/
Python Data Visualization Cookbook 2nd Edition Igor
Milovanovic Digital Instant Download
Author(s): Igor Milovanovic, Dimitry Foures, Giuseppe Vettigli
ISBN(s): 9781784396695, 1784396699
Edition: 2nd
File Details: PDF, 19.66 MB
Year: 2015
Language: english
www.it-ebooks.info
Python Data Visualization
Cookbook
Second Edition

Over 70 recipes, based on the principal concepts


of data visualization, to get you started with popular
Python libraries

Igor Milovanović
Dimitry Foures
Giuseppe Vettigli

BIRMINGHAM - MUMBAI

www.it-ebooks.info
Python Data Visualization Cookbook
Second Edition

Copyright © 2015 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system,
or transmitted in any form or by any means, without the prior written permission of the
publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the
information presented. However, the information contained in this book is sold without
warranty, either express or implied. Neither the authors, nor Packt Publishing, and its
dealers and distributors will be held liable for any damages caused or alleged to be
caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.

First published: November 2013


Second edition: November 2015

Production reference: 1261115

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham B3 2PB, UK.

ISBN 978-1-78439-669-5

www.packtpub.com

www.it-ebooks.info
Credits

Authors Project Coordinator


Igor Milovanović Nidhi Joshi
Dimitry Foures
Giuseppe Vettigli Proofreader
Safis Editing

Reviewer
Kostiantyn Kucher Indexer
Rekha Nair

Commissioning Editor
Akram Hussain Graphics
Jason Monteiro

Acquisition Editor
Meeta Rajani Production Coordinator
Manu Joseph

Content Development Editor


Mayur Pawanikar Cover Work
Manu Joseph

Technical Editor
Anushree Arun Tendulkar

Copy Editor
Charlotte Carneiro

www.it-ebooks.info
About the Authors

Igor Milovanović is an experienced developer, with strong background in Linux system


knowledge and software engineering education, he is skilled in building scalable data-driven
distributed software rich systems.

Evangelist for high-quality systems design who holds strong interests in software architecture
and development methodologies, Igor is always persistent on advocating methodologies
which promote high-quality software, such as test-driven development, one-step builds and
continuous integration.

He also possesses solid knowledge of product development. Having field experience and
official training, he is capable of transferring knowledge and communication flow from
business to developers and vice versa.

Igor is most grateful to his girlfriend for letting him spent hours on the work instead with
her and being avid listener to his endless book monologues. He thanks his brother for
being the strongest supporter. He is thankful to his parents to let him develop in various
ways and become a person he is today.

Dimitry Foures is a data scientist with a background in applied mathematics and


theoretical physics. After completing his undergraduate studies in physics at ENS Lyon
(France), he studied fluid mechanics at École Polytechnique in Paris where he obtained
a first class master's. He holds a PhD in applied mathematics from the University of
Cambridge. He currently works as a data scientist for a smart-energy startup in
Cambridge, in close collaboration with the university.

Giuseppe Vettigli is a data scientist who has worked in the research industry and
academia for many years. His work is focused on the development of machine learning
models and applications to use information from structured and unstructured data.
He also writes about scientific computing and data visualization in Python on his blog
at http://glowingpython.blogspot.com.

www.it-ebooks.info
About the Reviewer

Kostiantyn Kucher was born in Odessa, Ukraine. He received his master's degree in
computer science from Odessa National Polytechnic University in 2012, and he has used
Python as well as matplotlib and PIL for machine learning and image recognition purposes.

Since 2013, Kostiantyn has been a PhD student in computer science specializing in information
visualization. He conducts his research under the supervision of Prof. Dr. Andreas Kerren with
the ISOVIS group at the Computer Science department of Linnaeus University (Växjö, Sweden).

Kostiantyn was a technical reviewer for the first edition of this book.

www.it-ebooks.info
www.PacktPub.com

Support files, eBooks, discount offers, and more


For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub
files available? You can upgrade to the eBook version at www.PacktPub.com and as a print
book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
service@packtpub.com for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a
range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
TM

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book
library. Here, you can search, access, and read Packt's entire library of books.

Why Subscribe?
ff Fully searchable across every book published by Packt
ff Copy and paste, print, and bookmark content
ff On demand and accessible via a web browser

Free Access for Packt account holders


If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view 9 entirely free books. Simply use your login credentials for
immediate access.

www.it-ebooks.info
Table of Contents
Preface v
Chapter 1: Preparing Your Working Environment 1
Introduction 1
Installing matplotlib, NumPy, and SciPy 2
Installing virtualenv and virtualenvwrapper 4
Installing matplotlib on Mac OS X 7
Installing matplotlib on Windows 9
Installing Python Imaging Library (PIL) for image processing 10
Installing a requests module 11
Customizing matplotlib's parameters in code 12
Customizing matplotlib's parameters per project 14
Chapter 2: Knowing Your Data 17
Introduction 17
Importing data from CSV 18
Importing data from Microsoft Excel files 20
Importing data from fixed-width data files 23
Importing data from tab-delimited files 25
Importing data from a JSON resource 27
Exporting data to JSON, CSV, and Excel 29
Importing and manipulating data with Pandas 34
Importing data from a database 35
Cleaning up data from outliers 40
Reading files in chunks 45
Reading streaming data sources 47
Importing image data into NumPy arrays 49
Generating controlled random datasets 55
Smoothing the noise in real-world data 62

www.it-ebooks.info
Table of Contents

Chapter 3: Drawing Your First Plots and Customizing Them 69


Introduction 70
Defining plot types – bar, line, and stacked charts 70
Drawing simple sine and cosine plots 76
Defining axis lengths and limits 79
Defining plot line styles, properties, and format strings 82
Setting ticks, labels, and grids 87
Adding legends and annotations 90
Moving spines to the center 93
Making histograms 95
Making bar charts with error bars 97
Making pie charts count 100
Plotting with filled areas 102
Making stacked plots 104
Drawing scatter plots with colored markers 107
Chapter 4: More Plots and Customizations 111
Introduction 111
Setting the transparency and size of axis labels 112
Adding a shadow to the chart line 114
Adding a data table to the figure 118
Using subplots 120
Customizing grids 123
Creating contour plots 128
Filling an under-plot area 131
Drawing polar plots 134
Visualizing the filesystem tree using a polar bar 136
Customizing matplotlib with style 140
Chapter 5: Making 3D Visualizations 143
Introduction 143
Creating 3D bars 143
Creating 3D histograms 147
Animating in matplotlib 150
Animating with OpenGL 154
Chapter 6: Plotting Charts with Images and Maps 159
Introduction 159
Processing images with PIL 160
Plotting with images 166
Displaying images with other plots in the figure 171
Plotting data on a map using Basemap 174

ii

www.it-ebooks.info
Table of Contents
Plotting data on a map using the Google Map API 179
Generating CAPTCHA images 185
Chapter 7: Using the Right Plots to Understand Data 191
Introduction 191
Understanding logarithmic plots 192
Understanding spectrograms 195
Creating stem plot 200
Drawing streamlines of vector flow 204
Using colormaps 208
Using scatter plots and histograms 213
Plotting the cross correlation between two variables 221
Importance of autocorrelation 224
Chapter 8: More on matplotlib Gems 229
Introduction 229
Drawing barbs 229
Making a box-and-whisker plot 233
Making Gantt charts 236
Making error bars 241
Making use of text and font properties 244
Rendering text with LaTeX 251
Understanding the difference between pyplot and OO API 255
Chapter 9: Visualizations on the Clouds with Plot.ly 261
Introduction 261
Creating line charts 262
Creating bar charts 266
Plotting a 3D trefoil knot 269
Visualizing maps and bubbles 272
Index 275

iii

www.it-ebooks.info
www.it-ebooks.info
Preface
The best data is the data that we can see and understand. As developers and data scientists,
we want to create and build the most comprehensive and understandable visualizations.
It is not always simple; we need to find the data, read it, clean it, filter it, and then use the
right tool to visualize it. This book explains the process of how to read, clean, and visualize
the data into information with straight and simple (and sometimes not so simple) recipes.

How to read local data, remote data, CSV, JSON, and data from relational databases are all
explained in this book.

Some simple plots can be plotted with one simple line in Python using matplotlib, but
performing more advanced charting requires knowledge of more than just Python. We need
to understand information theory and human perception aesthetics to produce the most
appealing visualizations.

This book will explain some practices behind plotting with matplotlib in Python, statistics used,
and usage examples for different charting features that we should use in an optimal way.

What this book covers


Chapter 1, Preparing Your Working Environment, covers a set of installation recipes and advice
on how to install the required Python packages and libraries on your platform.

Chapter 2, Knowing Your Data, introduces you to common data formats and how to read and
write them, be it CSV, JSON, XSL, or relational databases.

Chapter 3, Drawing Your First Plots and Customizing Them, starts with drawing simple plots
and covers some customization.

Chapter 4, More Plots and Customizations, follows up from the previous chapter and covers
more advanced charts and grid customization.

Chapter 5, Making 3D Visualizations, covers three-dimensional data visualizations such as


3D bars, 3D histograms, and also matplotlib animations.

www.it-ebooks.info
Preface

Chapter 6, Plotting Charts with Images and Maps, deals with image processing, projecting
data onto maps, and creating CAPTCHA test images.

Chapter 7, Using Right Plots to Understand Data, covers explanations and recipes on some
more advanced plotting techniques such as spectrograms and correlations.

Chapter 8, More on matplotlib Gems, covers a set of charts such as Gantt charts, box plots,
and whisker plots, and it also explains how to use LaTeX for rendering text in matplotlib.

Chapter 9, Visualizations on the Clouds with Plot.ly, introduces how to use Plot.ly to create
and share your visualizations on its cloud environment.

What you need for this book


For this book, you will need Python 2.7.3 or a later version installed on your operating system.

Another software package used in this book is IPython, which is an interactive Python
environment that is very powerful and flexible. This can be installed using package
managers for Linux-based OSes or prepared installers for Windows and Mac OS X.

If you are new to Python installation and software installation in general, it is highly
recommended to use prepackaged scientific Python distributions such as Anaconda,
Enthought Python Distribution or Python(x, y).

Other required software mainly comprises Python packages that are all installed using the
Python installation manager, pip, which itself is installed using Python's easy_install setup tool.

Who this book is for


Python Data Visualization Cookbook, Second Edition is for developers and data scientists who
already use Python and want to learn how to create visualizations of their data in a practical
way. If you have heard about data visualization but don't know where to start, this book will
guide you from the start and help you understand data, data formats, data visualization, and
how to use Python to visualize data.

You will need to know some general programming concepts, and any kind of programming
experience will be helpful. However, the code in this book is explained almost line by line.
You don't need math for this book; every concept that is introduced is thoroughly explained
in plain English, and references are available for further interest in the topic.

vi

www.it-ebooks.info
Preface

Sections
In this book, you will find several headings that appear frequently (Getting ready, How to do it,
How it works, There's more, and See also).

To give clear instructions on how to complete a recipe, we use these sections as follows:

Getting ready
This section tells you what to expect in the recipe, and describes how to set up any software or
any preliminary settings required for the recipe.

How to do it…
This section contains the steps required to follow the recipe.

How it works…
This section usually consists of a detailed explanation of what happened in the previous section.

There's more…
This section consists of additional information about the recipe in order to make the reader
more knowledgeable about the recipe.

See also
This section provides helpful links to other useful information for the recipe.

Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of
information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames,
dummy URLs, user input, and Twitter handles are shown as follows: "We packed our little demo
in the DemoPIL class, so that we can extend it easily, while sharing the common code around
the demo function, run_fixed_filters_demo."

vii

www.it-ebooks.info
Preface

A block of code is set as follows:


def my_function(x):
return x*x

When we wish to draw your attention to a particular part of a code block, the relevant lines or
items are set in bold:
for a in range(10):
print a

Any command-line input or output is written as follows:


$ sudo python setup.py install

Warnings or important notes appear in a box like this.

Tips and tricks appear like this.

Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this
book—what you liked or may have disliked. Reader feedback is important for us to develop
titles that you really get the most out of.

To send us general feedback, simply send an e-mail to feedback@packtpub.com, and


mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or
contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to
get the most from your purchase.

viii

www.it-ebooks.info
Random documents with unrelated
content Scribd suggests to you:
Fig. 37.—View of Dwelling from Garden, Tokio.

The verandah is quite spacious; and in line with the division between
the rooms is a groove for the adjustment of a wooden screen or
shutter when it is desired to separate the house into two portions
temporarily. At the end of the verandah to the left of the sketch is the
latrine. The house is quite open beneath, and the air has free
circulation.
Fig. 38.—Dwelling Near Kudan, Tokio.

Another type of a Tokio house is shown in Fig. 38. This is a low, one-
storied house, standing directly upon the street, its tiled roof cut up
into curious gables. The entrance is protected by a barred sliding
door. A large hanging bay-window is also barred. Just over the fence
a bamboo curtain may be seen, which shades the verandah. The
back of the house was open, and probably looked out on a pretty
garden,—though this I did [pg 57] not see, as this sketch, like many
others, was taken somewhat hastily.

From this example some idea may be got of the diminutive character
of many of the Japanese dwellings, in which, nevertheless, families
live in all cleanliness and comfort.

Fig. 39.—Country Inn in Rikuzen.

In the northern part of Japan houses are often seen which possess
features suggestive of the picturesque architecture of Switzerland,—
the gable ends showing, in their exterior, massive timbers roughly
hewn, with all the irregularities of the tree-trunk preserved, the
interstices between these beams being filled with clay or plaster. The
eaves are widely overhanging, with projecting rafters. Oftentimes
delicately-carved wood is seen about the gable-ends and projecting
balcony. As a still further suggestion of this resemblance, the main
roof, if shingled, as well as the roof that shelters the verandah, is
weighted with stones of various sizes to prevent its being blown away
by the high [pg 58] winds that often prevail. This feature is
particularly common in the Island of Yezo.

Fig. 39 gives a house of this description near Matsushima, in Rikuzen.


An opening for the egress of smoke occurs on the side of the roof, in
shape not unlike that of a round-topped dormer window. This
opening in almost every instance is found on the gable end, directly
beneath the angle formed at the peak of the roof.

Fig. 40.—Country Inn in Rikuzen.

Another house of this kind, seen in the same province, is shown in


fig. 40. Here the smoke-outlet is on the ridge in the shape of an
angular roof, with its ridge running at right angles to the main ridge;
in this is a latticed window. This ventilator, as well as the main roof, is
heavily thatched, while the supplementary ridge is of boards and
weighted with stones. A good example of a heavily-tiled and
plastered wooden fence is seen on the left of the sketch. In the road
a number of laborers are shown in the act of moving a heavy block of
stone.

[pg 59]

Fig. 41.—House Near Mororan, Yezo.

Another house, shown in fig. 41, was seen on the road to Mororan, in
Yezo. Here the smoke-outlet was in the form of a low supplementary
structure on the ridge. The ridge itself was flat, and upon it grew a
luxuriant mass of lilies. This roof was unusually large and capacious.

At the place where the river Kitakami empties into the Bay of Sendai,
and where we left our boat in which we had come down the river
from Morioka, the houses were all of the olden-style,—a number of
these presenting some good examples of projecting windows. Fig. 42
represents the front of a house in this place. This shows a large
gable-roof, with broad overhanging eaves in front,—the ends of the
rafters projecting to support the eaves and the transverse-beams of
the gable ends being equally in sight. The projecting window, which
might perhaps be called a bay, runs nearly the entire length of the
gable. The panels in the frieze were of [pg 60] dark wood, and bore
perforated designs of pine and bamboo alternating.

The larger houses of this description are always inns. They usually
abut directly upon the road, and have an open appearance and an air
of hospitality about them which at once indicates their character. One
encounters such places so frequently in Japan, that travelling in the
interior is rendered a matter of ease and comfort as compared with
similar experiences in neighboring countries. The larger number of
these inns in the north are of one-story, though many may be seen
that are two-storied. Very rarely does a three-storied building occur.
Fig. 43 represents one of this nature, that was seen in a small village
north of Sendai.

Fig. 42.—Bay Window, Village of Odzuka, Rikuzen.


Fig. 43.—Three-storied House in Rikuchiu.

Houses of the better classes stand back from the road, and have
bordering the road high and oftentimes ponderous ridged walls, with
gateways of similar proportions and character, or fences of various
kinds with rustic gateways. Long, low [pg 61] out-buildings, for
servants' quarters, also often form portions of the boundary wall. In
the denser part of larger cities it is rare to find an old house,—the
devastating conflagrations that so often sweep across the cities
rendering the survival of old houses almost an impossibility. In the
suburbs of cities and in the country, however, it is not difficult to find
houses one hundred, and even two or three hundred years old. The
houses age as rapidly as the people, and new houses very soon turn
gray from the weather; the poorer class of houses in particular
appear much older than they really are.
Fig. 44.—Street in the Suburbs of Morioka.

In entering Morioka, at the head of navigation on the Kitakami River,


the long street presents a remarkably pretty appearance, with its odd
low-roofed houses (fig. 44), each standing with its end to the street,
—the peak of the thatched roof overhanging the smoke-outlet like a
hood. The street is bordered by a high, rustic, bamboo fence; and
between the houses are little plats filled with bright-colored flowers,
and shrubbery clustering within the fences, even sending its sprays
into the footpath bordering the road.

[pg 62]
The country house of an independent samurai, or rich farmer, is
large, roomy, and thoroughly comfortable. I recall with the keenest
pleasure the delightful days enjoyed under the roof of one of these
typical mansions in Kabutoyama, in the western part of the province
of Musashi. The residence consisted of a group of buildings shut in
from the road by a high wall. Passing through a ponderous gateway,
one enters a spacious court-yard, flanked on either side by long, low
buildings used as store-houses and servants' quarters. At the farther
end of the yard, and facing the entrance, was a comfortable old
farmhouse, having a projecting gable-wing to its right (fig. 45). The
roof was a thatched one of unusual thickness. At the end of the wing
was a triangular latticed opening, from which thin blue wreaths of
smoke were curling. This building contained a few rooms, including
an unusually spacious kitchen,—a sketch of which is given farther on.
The kitchen opened directly into a larger and unfinished portion of
the house, having the earth [pg 63] for its floor, and used as a wood-
shed. The owner informed me that the farm-house was nearly three
hundred years old. To the left of the building was a high wooden
fence, and passing through a gateway one came into a smaller yard
and garden. In this area was another house quite independent of the
farmhouse; this was the house for guests. Its conspicuous feature
consisted of a newly-thatched roof, surmounted by an elaborate and
picturesque ridge,—its design derived from temple architecture.
Within were two large rooms opening upon a narrow verandah.
These rooms were unusually high in stud, and the mats and all the
appointments were most scrupulously clean. Communication with the
old house was by means of a covered passage. Back of this dwelling,
and some distance from it, was still another house, two stories in
height, and built in the most perfect taste; and here lived the
grandfather of the family,—a fine old gentleman, dignified and courtly
in his manners.

Fig. 45.—Old Farm-house in Kabutoyama.

The farm-house yard presented all the features of similar areas at


home. A huge pile of wood cut for the winter's supply was piled up
against the L. Basket-like coops, rakes, and the customary utensils of
a farmer's occupation were scattered about. The sketch of this old
house gives but a faint idea of the massive and top-heavy
appearance of the roof, or of the large size of the building. The
barred windows below, covered by a narrow tiled roof, were much
later additions to the structure.

In the city houses of the better class much care is often taken to
make the surroundings appear as rural as possible, by putting here
and there quaint old wells, primitive and rustic arbors, fences, and
gateways. The gateways receive special attention in this way, and the
oddest of entrances are often seen in thickly-settled parts of large
cities.

Houses with thatched roofs, belonging to the wealthiest classes, are


frequently seen in the suburbs of Tokio and Kioto, and, strange as it
may appear, even within the city proper. One might be led [pg 64] to
suppose that such roofs would quickly fall a prey to the sparks of a
conflagration; but an old thatched roof gets compacted with dust and
soot to such an extent that plants and weeds of various kinds, and
large clumps of mosses, are often seen flourishing in luxuriance upon
such surfaces, offering a good protection against flying sparks. In
Kioto we recall a house of this description which was nearly three
centuries old; and since we made sketches of its appearance from
the street, from just within the gateway, and from the rear, we will
describe these views in sequence.

Fig. 46.—Entrance to Court-yard of Old House in Kioto.

The first view, then (fig. 46), is from the street, and represents a
heavily-roofed gateway, with a smaller gateway at the side. The big
gates had been removed, and the little gateway was permanently
closed. This ponderous structure was flanked on one side by a low
stretch of buildings, plastered on the outside, having small barred
windows on the street, and a barred look-out commanding the
gateway both outside and within. On the other side of the gateway
was a high, thick wall, also furnished with a [pg 65] window or
lookout. The outer walls rose directly from the wall forming the
gutter, or, more properly speaking, a diminutive moat that ran along
the side of the street. Blocks of worked stone formed a bridge across
this moat, by which access was gained to the enclosure. The old
dwelling, with its sharp-ridged roof, may be seen above the buildings
just described.

Fig. 47.—Old house in Kioto. Court-yard view.

Fig. 47 represents the appearance of this old house from just within
the gateway. The barred window to the left of the sketch may be
seen through the open gateway in fig. 46, and the tree which showed
over the top of the gateway in that sketch is now in full view. The old
house has a thatched roof with a remarkably steep pitch, surmounted
by a ridge of tiles; a narrow tiled roof runs about the house directly
below the eaves of the thatched roof. Suspended below this roof is
seen a ladder and fire-engine, to be ready in case of emergency. The
truth must be [pg 66] told, however, that these domestic engines are
never ready; for when they are wanted, it is found that the square
cylinders are so warped and cracked by the hot summers that when
they are brought into action their chief accomplishment consists in
squirting water through numerous crevices upon the men who are
frantically endeavoring to make these engines do their duty properly.

Fig. 48.—Old House in Kioto, Garden View.

The yard was well swept, and quite free from weeds, though at one
side a number of shrubs and a banana tree were growing in a
luxuriant tangle. A single tree, of considerable age, rose directly in a
line with the entrance to the yard.

The house, like all such houses, had its uninteresting end toward the
street; and here, attached to the house, was a “lean-to,” or shed,
with a small circular window. This was [pg 67] probably a kitchen, as
a gateway is seen in the sketch, which led to the kitchen-garden.

In Fig. 48 a sketch of this house is given from the garden in the rear.
The house is quite open behind, and looks out on the garden and
fish-pond, which is seen in the foreground. The tiled roof which
covers the verandah, and the out-buildings as well, was a subsequent
addition to the old house. The sole occupants consisted of the
mother and maiden sister of the famous antiquarian Ninagawa
Noritani. The garden, with its shrubs, plats of flowers, stepping-
stones leading to the fish-pond filled with lotus and lilies, and the
bamboo trellis, is a good specimen of an old garden upon which but
little care has been bestowed.

In the cities nothing is more surprising to a foreigner than to go from


the dust and turmoil of a busy street directly into a rustic yard and
the felicity of quiet country life. On one of the busy streets of Tokio I
had often passed a low shop, the barred front of which was never
opened to traffic, nor was there ever any one present with whom to
deal. I used often to peer between the bars; and from the form of
the wooden boxes on the step-like shelves within, I knew that the
occupant was a dealer in old pottery. One day I called through the
bars several times, and finally a man pushed back the screen in the
rear of the shop and bade me come in by way of a narrow alley a
little way up the street. This I did, and soon came to a gate that led
me into one of the neatest and cleanest little gardens it is possible to
imagine. The man was evidently just getting ready for a tea-party,
and, as is customary in winter, the garden had been liberally strewn
with pine-needles, which had then been neatly swept from the few
paths and formed in thick mats around some of the shrubs and trees.
The master had already accosted me from the verandah, and after
bringing the customary hibachi, over which I warmed my hands, and
tea and cake, he brought forth some rare old pottery.

[pg 68]
Fig. 49.—House in Tokio.

The verandah and a portion of this house as it appeared from the


garden are given in fig. 49. At the end of the verandah is seen a
narrow partition, made out of the planks of an old [pg 69] ship; it is
secured to the side of the house by a huge piece of bamboo. One is
greatly interested to see how curiously, and oftentimes artistically, the
old worm-eaten and blackened fragments of a shipwreck are worked
into the various parts of a house,—this being an odd fancy of the
Japanese house-builder. Huge and irregular-shaped logs will often
form the cross-piece to a gateway; rudder-posts fixed in the ground
form the support of bronze or pottery vessels to hold water. But
fragments of a shipwreck are most commonly seen. This wood is
always rich in color, and has an antique appearance,—these qualities
commending it at once to the Japanese eye, and rendering it, with its
associations, an attractive object for their purposes.

In the house above mentioned a portion of a vessel's side or bottom


had been used bodily for a screen at the end of the verandah,—for
just beyond was the latrine, from the side of which is seen jutting
another wing, consisting of a single weatherworn plank bordered by a
bamboo-post. This was a screen to shut out the kitchen-yard beyond.
Various stepping-stones of irregular shape, as well as blackened
planks, were arranged around the yard in picturesque disorder. The
sketch conveys, with more or less accuracy, one of the many phases
of Japanese taste in these matters.

The wood-work from the rafters of the verandah roof above, to the
planks below, was undefiled by oil, paint, wood-filling, or varnish of
any kind. The carpentry was light, yet durable and thoroughly
constructive; while outside and inside every feature was as neat and
clean as a cabinet. The room bordering this verandah is shown in fig.
125.
Fig. 50.—View from the Second Story of Dwelling in Imado, Tokio.

Fig. 50 gives a view from the L of a gentleman's house in Tokio, from


which was seen the houses and gardens of the neighborhood. The
high and close fence borders a roadway which runs along the bank of
the Sumida-gawa. A short fence of brush juts out obliquely from the
latrine, and forms a screen [pg 70] between the house and the little
gate. From this sketch some idea may be formed of the appearance
of the balcony and verandah, and how well they are protected by the
overhanging roofs.

The inns, particularly the country inns, have a most cosey and
comfortable air about them. One always has the freedom of the
entire place; at least a foreigner generally makes himself at home
everywhere about the public houses, and in this respect [pg 71]
impress a Japanese with his boorish ways, since the native guests
usually keep to their own rooms. The big, capacious kitchen, with its
smoke-blackened rafters overhead, its ruddy glow of wood-fire (a
sight rarely seen in the cities, where charcoal is the principal fuel),
and the family busy with their various domestic duties, is a most
cosey and agreeable region.

Fig. 51.—Old Inn in Mishima, Suruga.

On the ride across Yezo, from Otarunai to Mororan, one passes a


number of inns of the most ample proportions; and their present
deserted appearance contrasts strangely with their former grandeur,
when the Daimio of the province, accompanied by swarms of samurai
and other attendants, made his annual pilgrimage to the capital.

At Mishima, in the province of Suruga, a curious old inn was seen


(fig. 51). The second story overhung the first story in front, [pg 72]
and the eaves were very widely-projecting. At the sides of the
building a conspicuous feature was the verge boards, which were
very large, with their lower margins cut in curious sweeps. This may
have been intended for an architectural adornment, or possibly for a
wind or sun screen; at all events it was, as we saw it, associated with
buildings of considerable antiquity. In the middle and southern
provinces of Japan the feature of an over-hanging second story is by
no means uncommon.

Fig. 52.—Village Street in Nasaike, Yamashiro.

A group of houses in a village street is shown in fig. 52. The nearest


house is a resting-place for travellers; the next is a candle-shop,
where the traveller and jinrikisha man may replenish their lanterns;
the third is a jinrikisha stand, and beyond this is a light board-
structure of some kind. All of these are dwellings as well. This street
was in the village of Nagaike, between Nara and Kioto.

The country houses on the east coast of Kagoshima Gulf, in the


province of Osumi, as well as in the province of Satsuma, have
thatched roofs of ponderous proportions, while the walls supporting
them are very low. These little villages along the [pg 73] coast
present a singular aspect, as one distinguishes only the high and
thick roofs. Fig. 53 is a sketch of Mototaru-midsu as from the water,
and fig. 54 represents the appearance of a group of houses seen in
the same village, which is on the road running along the gulf coast of
Osumi. The ridge is covered by a layer of bamboo; and the ends of
the ridge, where it joins the hip of the roof, are guarded by a stout
matting of bamboo and straw. In this sketch a regular New England
well-sweep is seen, though it is by no means an uncommon object in
other parts of Japan. Where the well is [pg 74] under cover, the well-
sweep is so arranged that the well-pole goes through a hole in the
roof.

Fig. 53.—Shore of Osumi.

Fig. 54.—Farmer's Houses in Mototaru-Midsu, Osumi.


The fishermen's houses are oftentimes nothing more than the
roughest shelters from the elements, and being more closed than the
peasants' houses are consequently darker and dirtier. In the
neighborhood of larger towns, where the fishermen are more
prosperous, their houses compare favorably with those of the
peasant class. Fig. 55 shows a group of fishermen's huts on the neck
of sand which connects Hakodate with the main island. The high
stockade fences act as barriers to the winds which blow so furiously
across the bar at certain seasons. Fig. 56 represents a few
fishermen's huts at Enoshima, a famous resort a little south of
Yokohama. Here the houses are comparatively large and comfortable,
though poor and dirty at best. The huge baskets seen in the sketch
are used to hold and transport fish from the boat to the shore.

Fig. 55.—Fishermen's Huts in Hakodate.

Fig. 56.—Fishermen's Huts in Enoshima.

[pg 75]
In the city no outbuildings, such as sheds and barns, are seen.
Accompanying the houses of the better class are solid, thick-walled,
fire-proof buildings called kura, in which the goods and chattels are
stowed away in times of danger from conflagrations. These buildings,
which are known to the foreigner as “go-downs,” are usually two
stories in height, and have one or two small windows, and one door,
closed by thick and ponderous shutters. Such a building usually
stands isolated from the dwelling, and sometimes, though rarely, they
are converted into domiciles. Of such a character is the group of
buildings in Tokio represented in fig. 57, belonging to a genial
antiquary, in which he has stored a rare collection of old books,
manuscripts, paintings, and other antique objects.

Fig. 57.—Kura in Tokio.

Fig. 58.—Kura, or Fire-proof Buildings in Tokio.

Fig. 58, copied from a sketch made by Mr. S. Koyama, represents


another group of these buildings in Tokio. These kura belonged to the
famous [pg 76] antiquarian Ninagawa Noritani. In these buildings
were stored his treasures of pottery and painting. Often light wooden
extensions are built around the kura, and in such cases the family live
in the outside apartments. An example of this kind is shown in fig.
59, which is an old house in a poor quarter of the city of Hakodate.
The central portion represents the two-storied kura, and around it is
built an additional shelter having a tiled roof. In case of fire the
contents of the outer rooms are hurriedly stowed within the fire-proof
portion, the door closed, and the crevices chinked with mud. These
buildings usually survive in the midst of a wide-spread conflagration,
while all the outer wooden additions are consumed. Further reference
will be made to these structures in other portions of the work. It may
be proper to state, however, that nearly every shop has connected
with it a fire-proof building of this nature.

Fig. 59.—Old House in Hakodate.

It hardly comes within the province of this work to describe or figure


buildings which are not strictly speaking homes; for this reason no
reference will be made to the monotonous rows of buildings so
common in Tokio, which form portions of the boundary-wall [pg 77]
wall of the yashiki; and, indeed, had this been desirable, it would
have been somewhat difficult to find the material, in their original
condition, for study. Many of the yashikis have been destroyed by
fire; others have been greatly modified, and are now occupied by
various Government departments. In Tokio, for example, the yashiki
of the Daimio of Kaga is used by the educational department, the
Mito yashiki for the manufacture of war material, and still others are
used for barracks and other Government purposes. As one rides
through the city he often passes these yashikis, showing from the
street as long monotonous rows of buildings, generally two stories in
height, with heavy tiled roofs. The wall of the first story is generally
tiled or plastered. The second-story wall may be of wood or plaster.
This wall is perforated at intervals with small heavily-barred windows
or hanging bays. The entrance, composed of stout beams, is closed
by ponderous gates thickly studded with what appear to be massive-
headed bolts, but which are, however, of fictitious solidity. The
buildings rest on stone foundations abutting directly on the street, or
interrupted by a ditch which often assumes the dignity of a castle
moat. These buildings in long stretches formed a portion of the outer
walls of the yashikis within which were the separate residences of the
Daimios and officers, while the buildings just alluded to were used by
the soldiers for barracks.

The great elaboration and variety in the form and structure of the
house-roof almost merit the dignity of a separate section. For it is
mainly to the roof that the Japanese house owes its picturesque
appearance; it is the roof which gives to the houses that novelty and
variety which is so noticeable among them in different parts of the
country. The lines of a well-made thatched roof are something quite
remarkable in their proportions. A great deal of taste and skill is
displayed in the proper trimming of the eaves; and the graceful way
in which the [pg 78] eaves of the gable are made to join the side
eaves is always attractive and a noticeable feature in Japanese
architecture, and the admirable way in which a variety of gables are
made to unite with the main roof would excite praise from the most
critical architect.

The elaborate structure of the thatched and tiled roofs, and the great
variety in the design and structure of the ridges show what might be
done by a Japanese architect if other portions of the house-exterior
received an equal amount of ingenuity and attention.

Japanese roofs are either shingled, thatched, or tiled. In the country,


tiled roofs are the exception, the roofs being almost exclusively
thatched,—though in the smaller houses, especially in the larger
country villages, the shingled and tiled roofs are often seen. In the
larger towns and cities the houses are usually tiled; yet even here
shingled roofs are not uncommon, and though cheaper than the tiled
roofs, are by no means confined to the poorer houses. In the
suburbs, and even in the outskirts of the cities, thatched roofs are
common: in such cases the thatched roof indicates either the
presence of what was at one time an old farm-house to which the
city has extended, or else it is the house of a gentleman who prefers
such a roof on account of its picturesqueness and the suggestions of
rural life that go with it.

The usual form of the roof is generally that of a hip or gable. In the
thatched roof, the portion coming directly below the ridge-pole is in
the form of a gable, and this blends into a hip-roof. A curb-roof is
never seen. Among the poorer classes a simple pent roof is common;
and additions or attachments to the main building are generally
covered with a pent roof. A light, narrow, supplementary roof is often
seen projecting just below the eaves of the main roof; it is generally
made of wide thin boards (fig. 60). This roof is called hisashi. [pg 79]
It commonly shelters from the sun and rain an open portion of the
house or a verandah. It is either supported by uprights from the
ground, or by slender brackets which are framed at right angles to
the main uprights of the building proper. Weak and even flimsy as
this structure often appears to be, it manages to support itself, in
violation of all known laws of structure and gravitation. After a heavy
fall of damp snow one may see thick accumulations covering these
slight roofs, and yet a ride through the city reveals no evidences of
their breaking down. One recalls similar structures at home yielding
under like pressure, and wonders whether gravitation behaves
differently in this land of anomalies.
Fig. 60.—Hisashi.

In the ordinary shingled roof a light boarding is first nailed to the


rafters, and upon this the shingles are secured in close courses. The
shingles are always split, and are very thin,—being about the
thickness of an ordinary octavo book-cover, and not much larger in
size, and having the same thickness throughout. They come in
square bunches (fig. 61, A), each bunch containing about two
hundred and twenty shingles, and costing about forty cents.

Bamboo pins, resembling attenuated shoe-pegs, are used as shingle-


nails. The shingler takes a mouthful of these pegs, and with quick
motions works precisely and in the same rapid manner as a similar
class of workmen do at home. The shingler's hammer is a curious
implement (fig. 61, B, C). The iron portion is in the shape of a square
block, with its roughened face nearly on a level with its handle. Near
the end of the [pg 80] handle, and below, is inserted an indented
strip of brass (fig. 61, B). The shingler in grasping the handle brings
the thumb and forfinger opposite the strip of brass; he takes a peg
from his mouth with the same hand with which he holds the hammer,
and with the thumb and forefinger holding the peg against the brass
strip (fig. 62), he forces it into the shingle by a pushing blow. By this
movement the peg is forced half-way down; an oblique blow is then
given it with the hammer-head, which bends the protruding portion
of the peg against the shingle,—this broken-down portion
representing the head of our shingle-nail. The bamboo being tough
and fibrous can easily be broken down without separating. In this
way is the shingle held to the roof. The hammer-handle has marked
upon it the smaller divisions [pg 81] of a carpenter's measure, so that
the courses of shingles may be properly aligned. The work is done
very rapidly,—for with one hand the shingle is adjusted, while the
other hand is busily driving the pegs.

Fig. 61.—Bunch of shingles, nails, and hammer.

Fig. 62.—Shingler's Hand.


Fig. 63.—Bamboo Strips on Shingle-Roof.

That the shingles are not always held firmly to the roof by this
method of shingling is seen in the fact that oftentimes long narrow
strips of bamboo are nailed obliquely across the roof, from the ridge-
pole to the eaves (fig. 63). These strips are placed at the distance of
eighteen inches or two feet apart. Yet even in spite of this added
precaution, in violent gales the roof is often rapidly denuded of its
shingles, which fill the air at such times like autumn leaves.

Fig. 64, A, represents a portion of a shingled roof with courses of


shingles partially laid, and a shingler's nail-box held to the roof. The
box has two compartments,—the larger compartment holding the
bamboo pegs; and the smaller containing iron nails, used for nailing
down the boards and for other purposes.

There are other methods of shingling, in which the courses of


shingles are laid very closely together, and also in many layers.
Remarkable examples of this method may be seen in some of the
temple roofs, and particularly in the roofs of certain temple gateways
in Kioto, where layers of the thinnest shingles, forming a mass a foot
or more in thickness, are compactly laid, with the many graceful
contours of the roof delicately preserved. The edges of the roof are
beautifully rounded, and the eaves squarely and accurately trimmed.
On seeing one of these roofs [pg 82] one is reminded of a thatched
roof, which this style seems evidently intended to imitate. The rich
brown bark of the hi-no-ki tree is also used in a similar way; and a
very compact and durable roof it appears to make. In better shingled
house-roofs it is customary to secure a wedge-shaped piece of wood
parallel to the eaves, to which the first three or four rows of shingles
are nailed; other courses of shingles are then laid on very closely, and
thus a thicker layer of shingles is secured (fig. 64, B).
Fig. 64.—Roof with shingles partly laid.

But little variety of treatment of the ridge is seen in a shingled roof.


Two narrow weather-strips of wood nailed over the ridge answer the
purpose of a joint, as is customary in our shingled roofs. A more
thorough way is to nail thin strips of wood of a uniform length
directly over the ridge and at right angles to it. These strips are thin
enough to bend readily. Five or six layers are fastened in this way,
and then, more firmly to secure them to the roof, two long narrow
strips of wood or bamboo are nailed near the two edges of this mass,
parallel to the ridge (fig. 65).

Fig. 65.—Ridge on shingle-roof in Musashi.

[pg 83]
The shingled roof is the most dangerous element of house-structure
in the cities. The shingles are nothing more than thick shavings, and
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like