Cover
Title Page
Copyright
Contents
Preface
Introduction
About the Companion Website
Part I Static Graphics with ggplot (R) and Seaborn (Python)
Chapter 1 Scatterplots and Line Plots
1.1 R: ggplot
1.1.1 Scatterplot
1.1.2 Repulsive Textual Annotations: Package ggrepel
1.1.3 Scatterplots with High Number of Data Points
1.1.4 Line Plot
1.2 Python: Seaborn
1.2.1 Scatterplot
1.2.2 Line Plot
Chapter 2 Bar Plots
2.1 R: ggplot
2.1.1 Bar Plot and Continuous Variables: Ranges of Values
2.2 Python: Seaborn
2.2.1 Bar Plot with Three Variables
2.2.2 Ranges of Values from a Continuous Variable
2.2.3 Visualizing Subplots
Chapter 3 Facets
3.1 R: ggplot
3.1.1 Case 1: Temperature
3.1.2 Case 2: Air Quality
3.2 Python: Seaborn
3.2.1 Facet for Scatterplots and Line Plot
3.2.2 Line Plot
3.2.3 Facet and Graphics for Categorical Variables
3.2.4 Facet and Bar Plots
3.2.5 Facets: General Method
Chapter 4 Histograms and Kernel Density Plots
4.1 R: ggplot
4.1.1 Univariate Analysis
4.1.2 Bivariate Analysis
4.1.3 Kernel Density Plots
4.2 Python: Seaborn
4.2.1 Univariate Analysis
4.2.2 Bivariate Analysis
4.2.3 Logarithmic Scale
Chapter 5 Diverging Bar Plots and Lollipop Plots
5.1 R: ggplot
5.1.1 Diverging Bar Plot
5.1.2 Lollipop Plot
5.2 Python: Seaborn
5.2.1 Diverging Bar Plot
Chapter 6 Boxplots
6.1 R: ggplot
6.2 Python: Seaborn
Chapter 7 Violin Plots
7.1 R: ggplot
7.1.1 Violin Plot and Scatterplot
7.1.2 Violin Plot and Boxplot
7.2 Python: Seaborn
Chapter 8 Overplotting, Jitter, and Sina Plots
8.1 Overplotting
8.2 R: ggplot
8.2.1 Categorical Scatterplot
8.2.2 Violin Plot and Scatterplot with Jitter
8.2.3 Sina Plot
8.2.4 Beeswarm Plot
8.2.5 Comparison Between Jittering, Sina plot, and Beeswarm plot
8.3 Python: Seaborn
8.3.1 Strip Plot and Swarm Plot
8.3.2 Sina Plot
Chapter 9 Half‐Violin Plots
9.1 R: ggplot
9.1.1 Custom Function
9.1.2 Raincloud Plot
9.2 Python: Seaborn
Chapter 10 Ridgeline Plots
10.1 History of the Ridgeline
10.2 R: ggplot
Chapter 11 Heatmaps
11.1 R: ggplot
11.2 Python: Seaborn
Chapter 12 Marginals and Plots Alignment
12.1 R: ggplot
12.1.1 Marginal
12.1.2 Plots Alignment
12.1.3 Rug Plot
12.2 Python: Seaborn
12.2.1 Subplots
12.2.2 Marginals: Joint Plot
12.2.3 Marginals: Joint Grid
Chapter 13 Correlation Graphics and Cluster Maps
13.1 R: ggplot
13.1.1 Cluster Map
13.2 Python: Seaborn
13.2.1 Cluster Map
13.3 R: ggplot
13.3.1 Correlation Matrix
13.4 Python: Seaborn
13.4.1 Correlation Matrix
13.4.2 Diagonal Correlation Heatmap
13.4.3 Scatterplot Heatmap
Part II Interactive Graphics with Altair
Chapter 14 Altair Interactive Plots
14.1 Scatterplots
14.1.1 Static Graphics
14.1.1.1 JSON Format: Data Organization
14.1.1.2 Plot Alignment and Variable Types
14.1.2 Facets
14.1.3 Interactive Graphics
14.1.3.1 Dynamic Tooltips
14.1.3.2 Interactive Legend
14.1.3.3 Dynamic Zoom
14.1.3.4 Mouse Hovering and Contextual Change of Color
14.1.3.5 Drop‐Down Menu and Radio Buttons
14.1.3.6 Selection with Brush
14.1.3.7 Graphics as Legends
14.2 Line Plots
14.2.1 Static Graphics
14.2.2 Interactive Graphics
14.2.2.1 Highlighted Lines with Mouse Hover
14.2.2.2 Aligned Tooltips
14.3 Bar Plots
14.3.1 Static Graphics
14.3.1.1 Diverging Bar Plot
14.3.1.2 Plots with Double Scale
14.3.1.3 Stacked Bar Plots
14.3.1.4 Sorted Bars
14.3.2 Interactive Graphics
14.3.2.1 Synchronized Bar Plots
14.3.2.2 Bar Plot with Slider
14.4 Bubble Plots
14.4.1 Interactive Graphics
14.4.1.1 Bubble Plot with Slider
14.5 Heatmaps and Histograms
14.5.1 Interactive Graphics
14.5.1.1 Heatmaps
14.5.1.2 Histograms
Part III Web Dashboards
Chapter 15 Shiny Dashboards
15.1 General Organization
15.2 Second Version: Graphics and Style Options
15.3 Third Version: Tabs, Widgets, and Advanced Themes
15.4 Observe and Reactive
Chapter 16 Advanced Shiny Dashboards
16.1 First Version: Sidebar, Widgets, Customized Themes, and Reactive/Observe
16.1.1 Button Widget: Observe Context
16.1.2 Button Widget: Mode of Operation
16.1.3 HTML Data Table
16.2 Second Version: Tabs, Shinydashboard, and Web Scraping
16.2.1 Shiny Dashboard
16.2.2 Web Scraping of HTML Tables
16.2.3 Shiny Dashboards and Altair Graphics Integration
16.2.4 Altair and Reticulate: Installation and Configuration
16.2.5 Simple Dashboard for Testing Shiny‐Altair Integration
16.3 Third Version: Altair Graphics
16.3.1 Cleveland Plot and Other Graphics
Chapter 17 Plotly Graphics
17.1 Plotly Graphics
17.1.1 Scatterplot
17.1.2 Line Plot
17.1.3 Marginals
17.1.4 Facets
Chapter 18 Dash Dashboards
18.1 Preliminary Operations: Import and Data Wrangling
18.1.1 Import of Modules and Submodules
18.1.2 Data Import and Data‐Wrangling Operations
18.2 First Dash Dashboard: Base Elements and Layout Organization
18.2.1 Plotly Graphic
18.2.2 Themes and Widgets
18.2.3 Reactive Events and Callbacks
18.2.4 Data Table
18.2.5 Color Palette Selector and Data Table Layout Organization
18.3 Second Dash Dashboard: Sidebar, Widgets, Themes, and Style Options
18.3.1 Sidebar, Multiple Selection, and Checkbox
18.3.2 Dark Themes
18.3.3 Radio Buttons
18.3.4 Bar Plot
18.3.5 Container
18.4 Third Dash Dashboard: Tabs and Web Scraping of HTML Tables
18.4.1 Multi‐page Organization: Tabs
18.4.2 Web Scraping of HTML Tables
18.4.3 Second Tab's Layout
18.4.4 Second Tab's Reactive Events
18.5 Fourth Dash Dashboard: Light Theme, Custom CSS Style Sheet, and Interactive Altair Graphics
18.5.1 Light Theme and External CSS Style Sheet
18.5.2 Altair Graphics
Part IV Spatial Data and Geographic Maps
Chapter 19 Geographic Maps with R
19.1 Spatial Data
19.2 Choropleth Maps
19.2.1 Eurostat – GISCO: giscoR
19.3 Multiple and Annotated Maps
19.3.1 From ggplot to Plotly Graphics
19.4 Spatial Data (sp) and Simple Features (sf)
19.4.1 Natural Earth
19.4.2 Format sp and sf: Centroid and Polygons
19.4.3 Differences Between Format sp and Format sf
19.5 Overlaid Graphical Layers
19.6 Shape Files and GeoJSON Datasets
19.7 Venice: Open Data Cartography and Other Maps
19.7.1 Tiled Web Maps
19.7.1.1 Package ggmap
19.7.1.2 Package Leaflet
19.7.2 Tiled Web Maps and Layers of sf Objects
19.7.2.1 Tiled Web Maps with ggmap
19.7.2.2 Tiled Web Map with Leaflet
19.7.3 Maps with Markers and Annotations
19.8 Thematic Maps with tmap
19.8.1 Static and Interactive Visualizations
19.8.2 Cartographic Layers: Rome's Archaeological Sites
19.9 Rome's Accommodations: Intersecting Geometries with Simple Features and tmap
19.9.1 Centroids and Active Geometry
19.9.2 Quantiles and Custom Legend
19.9.3 Variants with Points and Popups
Chapter 20 Geographic Maps with Python
20.1 New York City: Plotly
20.1.1 Choropleth Maps: plotly.express
20.1.1.1 Dynamic Tooltips
20.1.1.2 Mapbox
20.1.2 Choropleth Maps: plotly.graph_objects (plotly go)
20.1.3 GeoJSON Polygon, Multipolygon, and Missing id Element
20.2 Overlaid Layers
20.3 Geopandas: Base Map, Data Frame, and Overlaid Layers
20.3.1 Extended Dynamic Tooltips
20.3.2 Overlaid Layers: Dog Breeds, Dog Runs, and Parks Drinking Fountains
20.4 Folium
20.4.1 Base Maps, Markers, and Circles
20.4.2 Advanced Tooltips and Popups
20.4.3 Overlaid Layers and GeoJSON Datasets
20.4.4 Choropleth Maps
20.4.5 Geopandas
20.4.6 Folium Heatmap
20.5 Altair: Choropleth Map
20.5.1 GeoJSON Maps
20.5.2 Geopandas: NYC Subway Stations and Demographic Data
Index
EULA
Communicate the data that is powering our changing world with this essential text
The advent of machine learning and neural networks in recent years, along with other technologies under the broader umbrella of ‘artificial intelligence,’ has produced an explosion in Data Science research and applications. Data Visualization, which combines the technical knowledge of how to work with data and the visual and communication skills required to present it, is an integral part of this subject. The expansion of Data Science is already leading to greater demand for new approaches to Data Visualization, a process that promises only to grow.
Data Visualization in R and Python offers a thorough overview of the key dimensions of this subject. Beginning with the fundamentals of data visualization with Python and R, two key environments for data science, the book proceeds to lay out a range of tools for data visualization and their applications in web dashboards, data science environments, graphics, maps, and more. With an eye towards remarkable recent progress in open-source systems and tools, this book offers a cutting-edge introduction to this rapidly growing area of research and technological development.
Coverage suitable for anyone with a foundational knowledge of R and Python
Detailed treatment of tools including the Ggplot2, Seaborn, and Altair libraries, Plotly/Dash, Shiny, and others
Case studies accompanying each chapter, with full explanations for data operations and logic for each, based on Open Data from many different sources and of different formats
Data Visualization in R and Python is ideal for any student or professional looking to understand the working principles of this key field.