Database Reference
In-Depth Information
is presented are kept separate. Once data is loaded into a ggplot object, aesthetic func-
tions are used to describe how that data will be presented.
Listing 7.2 Using the ggplot2 library to create a scatterplot
# Load the ggplot library
library(ggplot2)
# Create a ggplot object, mapping eruptions and wait time using an
# aesthetic
geyser_plot <- ggplot(faithful, aes(eruptions, waiting))
# Instruct ggplot to construct a dot plotgeyser_plot + geom_point()
matplotlib: 2-D Charts with Python
For many developers, Python is the general-purpose language of choice. The sparse,
simple syntax and overall design philosophy mean that Python scripts are very read-
able and accessible. The sheer number of Python developers also ensures that there is
an enormous number of libraries available for data analysis work. The award-winning
iPython interactive shell is widely used by data analysts, and the iPython notebook
provides a Web-based interface for this powerful tool. Similarly, Python data analysis
libraries, such as SciPy and Pandas, are starting to rival R in terms of the number of
features available. For more on how Python is helping to make interactive data analy-
sis accessible to general purpose programmers, see Chapter 12, “Building Analytics
Workf lows Using Python and Pandas.”
An important part of the Python data analysis tool chain is matplotlib, a powerful
and actively-supported 2-D graphing and plotting library. matplotlib, developed pri-
marily by the late John D. Hunter, can generate a variety of charts and graphs. Apart
from sporting a familiar, Pythonic, object-oriented interface, matplotlib can also be
used in a procedural mode that resembles the interface of the commercial application
MatLab.
D3.js: Interactive Visualizations for the Web
If matplotlib's self-described motto (borrowed from PERL) is that it “tries to make
easy things easy and hard things possible,” then D3.js might be described as a toolkit
for making even impossible visualization needs possible. The Internet has obviously
become an amazing tool for sharing data, and when it comes to toolkits for building
interactive visualizations, very few options can touch the D3.js (D3 stands for data-
driven documents) library. D3.js is the successor to another popular JavaScript visual-
ization library, protovis. The lead developer for D3.js, Mike Bostock, currently works
for the New York Times, designing interactive data visualizations that sometimes stand
alone as stories in their own right. The use of D3.js and tools like it to create inter-
active visualizations for online publications is an excellent example of data-driven
journalism , a growing field that attempts to apply journalistic principles to data
 
 
Search WWH ::




Custom Search