Interactive Data Visualization with Python - Second Edition

Book description

Create your own clear and impactful interactive data visualizations with the powerful data visualization libraries of Python

Key Features

  • Study and use Python interactive libraries, such as Bokeh and Plotly
  • Explore different visualization principles and understand when to use which one
  • Create interactive data visualizations with real-world data

Book Description

With so much data being continuously generated, developers, who can present data as impactful and interesting visualizations, are always in demand. Interactive Data Visualization with Python sharpens your data exploration skills, tells you everything there is to know about interactive data visualization in Python.

You'll begin by learning how to draw various plots with Matplotlib and Seaborn, the non-interactive data visualization libraries. You'll study different types of visualizations, compare them, and find out how to select a particular type of visualization to suit your requirements. After you get a hang of the various non-interactive visualization libraries, you'll learn the principles of intuitive and persuasive data visualization, and use Bokeh and Plotly to transform your visuals into strong stories. You'll also gain insight into how interactive data and model visualization can optimize the performance of a regression model.

By the end of the course, you'll have a new skill set that'll make you the go-to person for transforming data visualizations into engaging and interesting stories.

What you will learn

  • Explore and apply different interactive data visualization techniques
  • Manipulate plotting parameters and styles to create appealing plots
  • Customize data visualization for different audiences
  • Design data visualizations using interactive libraries
  • Use Matplotlib, Seaborn, Altair and Bokeh for drawing appealing plots
  • Customize data visualization for different scenarios

Who this book is for

This book intends to provide a solid training ground for Python developers, data analysts and data scientists to enable them to present critical data insights in a way that best captures the user's attention and imagination. It serves as a simple step-by-step guide that demonstrates the different types and components of visualization, the principles, and techniques of effective interactivity, as well as common pitfalls to avoid when creating interactive data visualizations. Students should have an intermediate level of competency in writing Python code, as well as some familiarity with using libraries such as pandas.

Publisher resources

Download Example Code

Table of contents

  1. Preface
    1. About the Book
      1. About the Authors
      2. Learning Objectives
      3. Audience
      4. Approach
      5. Hardware Requirements
      6. Software Requirements
      7. Conventions
      8. Installation and Setup
      9. Additional Resources
  2. 1. Introduction to Visualization with Python – Basic and Customized Plotting
    1. Introduction
    2. Handling Data with pandas DataFrame
      1. Reading Data from Files
      2. Exercise 1: Reading Data from Files
      3. Observing and Describing Data
      4. Exercise 2: Observing and Describing Data
      5. Selecting Columns from a DataFrame
      6. Adding New Columns to a DataFrame
      7. Exercise 3: Adding New Columns to the DataFrame
      8. Applying Functions on DataFrame Columns
      9. Exercise 4: Applying Functions on DataFrame columns
      10. Exercise 5: Applying Functions on Multiple Columns
      11. Deleting Columns from a DataFrame
      12. Exercise 6: Deleting Columns from a DataFrame
      13. Writing a DataFrame to a File
      14. Exercise 7: Writing a DataFrame to a File
    3. Plotting with pandas and seaborn
      1. Creating Simple Plots to Visualize a Distribution of Variables
      2. Exercise 8: Plotting and Analyzing a Histogram
      3. Bar Plots
      4. Exercise 9: Creating a Bar Plot and Calculating the Mean Price Distribution
      5. Exercise 10: Creating Bar Plots Grouped by a Specific Feature
    4. Tweaking Plot Parameters
      1. Exercise 11: Tweaking the Plot Parameters of a Grouped Bar Plot
      2. Annotations
      3. Exercise 12: Annotating a Bar Plot
      4. Activity 1: Analyzing Different Scenarios and Generating the Appropriate Visualization
    5. Summary
  3. 2. Static Visualization – Global Patterns and Summary Statistics
    1. Introduction
    2. Creating Plots that Present Global Patterns in Data
      1. Scatter Plots
      2. Exercise 13: Creating a Static Scatter Plot
      3. Hexagonal Binning Plots
      4. Exercise 14: Creating a Static Hexagonal Binning Plot
      5. Contour Plots
      6. Exercise 15: Creating a Static Contour Plot
      7. Line Plots
      8. Exercise 16: Creating a Static Line Plot
      9. Exercise 17: Presenting Data across Time with multiple Line Plots
      10. Heatmaps
      11. Exercise 18: Creating and Exploring a Static Heatmap
      12. The Concept of Linkage in Heatmaps
      13. Exercise 19: Creating Linkage in Static Heatmaps
    3. Creating Plots That Present Summary Statistics of Your Data
      1. Histogram Revisited
      2. Example 1: Histogram Revisited
      3. Box Plots
      4. Exercise 20: Creating and Exploring a Static Box Plot
      5. Violin Plots
      6. Exercise 21: Creating a Static Violin Plot
      7. Activity 2: Design Static Visualization to Present Global Patterns and Summary Statistics
    4. Summary
  4. 3. From Static to Interactive Visualization
    1. Introduction
    2. Static versus Interactive Visualization
    3. Applications of Interactive Data Visualizations
    4. Getting Started with Interactive Data Visualizations
      1. Interactive Data Visualization with Bokeh
      2. Exercise 22: Preparing Our Dataset
      3. Exercise 23: Creating the Base Static Plot for an Interactive Data Visualization
      4. Exercise 24: Adding a Slider to the Static Plot
      5. Exercise 25: Adding a Hover Tool
      6. Interactive Data Visualization with Plotly Express
      7. Exercise 26: Creating an Interactive Scatter Plot
      8. Activity 3: Creating Different Interactive Visualizations Using Plotly Express
    5. Summary
  5. 4. Interactive Visualization of Data across Strata
    1. Introduction
    2. Interactive Scatter Plots
      1. Exercise 27: Adding Zoom-In and Zoom-Out to a Static Scatter Plot
      2. Exercise 28: Adding Hover and Tooltip Functionality to a Scatter Plot
      3. Exercise 29: Exploring Select and Highlight Functionality on a Scatter Plot
      4. Exercise 30: Generating a Plot with Selection, Zoom, and Hover/Tooltip Functions
      5. Selection across Multiple Plots
      6. Exercise 31: Selection across Multiple Plots
      7. Selection Based on the Values of a Feature
      8. Exercise 32: Selection Based on the Values of a Feature
    3. Other Interactive Plots in altair
      1. Exercise 33: Adding a Zoom-In and Zoom-Out Feature and Calculating the Mean on a Static Bar Plot
      2. Exercise 34: An Alternative Shortcut for Representing the Mean on a Bar Plot
      3. Exercise 35: Adding a Zoom Feature on a Static Heatmap
      4. Exercise 36: Creating a Bar Plot and a Heatmap Next to Each Other
      5. Exercise 37: Dynamically Linking a Bar Plot and a Heatmap
      6. Activity 4: Generate a Bar Plot and a Heatmap to Represent Content Rating Types in the Google Play Store Apps Dataset
    4. Summary
  6. 5. Interactive Visualization of Data across Time
    1. Introduction
    2. Temporal Data
    3. Types of Temporal Data
      1. Why Study Temporal Visualization?
    4. Understanding the Relation between Temporal Data and Time‑Series Data
    5. Examples of Domains That Use Temporal Data
    6. Visualization of Temporal Data
      1. How Time-Series Data Is Manipulated and Visualized
      2. Date/Time Manipulation in pandas
      3. Building a DateTime Index
    7. Choosing the Right Aggregation Level for Temporal Data
      1. Exercise 38: Creating a Static Bar Plot and Calculating the Mean and Standard Deviation in Temporal Data
      2. Exercise 39: Calculating zscore to Find Outliers in Temporal Data
    8. Resampling in Temporal Data
      1. Common Pitfalls of Upsampling and Downsampling
      2. Exercise 40: Upsampling and Downsampling in Temporal Data
      3. Using shift and tshift to Introduce a Lag in Time-Series Data
      4. Exercise 41: Using shift and tshift to Shift Time in Data
      5. Autocorrelation in Time Series
    9. Interactive Temporal Visualization
      1. Bokeh Basics
      2. Advantages of Using Bokeh
      3. Exercise 42: Adding Interactivity to Static Line Plots Using Bokeh
      4. Exercise 43: Changing the Line Color and Width on a Line Plot
      5. Exercise 44: Adding Box Annotations to Find Anomalies in a Dataset
      6. Interactivity in Bokeh
      7. Activity 5: Create an Interactive Temporal Visualization
    10. Summary
  7. 6. Interactive Visualization of Geographical Data
    1. Introduction
    2. Choropleth Maps
      1. Worldwide Choropleth Maps
      2. Exercise 45: Creating a Worldwide Choropleth Map
      3. Exercise 46: Tweaking a Worldwide Choropleth Map
      4. Exercise 47: Adding Animation to a Choropleth Map
      5. USA State Maps
      6. Exercise 48: Creating a USA State Choropleth Map
    3. Plots on Geographical Maps
      1. Scatter Plots
      2. Exercise 49: Creating a Scatter Plot on a Geographical Map
      3. Bubble Plots
      4. Exercise 50: Creating a Bubble Plot on a Geographical Map
      5. Line Plots on Geographical Maps
      6. Exercise 51: Creating Line Plots on a Geographical Map
      7. Activity 6: Creating a Choropleth Map to Represent Total Renewable Energy Production and Consumption across the World
    4. Summary
  8. 7. Avoiding Common Pitfalls to Create Interactive Visualizations
    1. Introduction
    2. Data Formatting and Interpretation
      1. Avoiding Common Pitfalls while Dealing with Dirty Data
      2. Outliers
      3. Exercise 52: Visualizing Outliers in a Dataset with a Box Plot
      4. Exercise 53: Dealing with Outliers
      5. Missing Data
      6. Exercise 54: Dealing with Missing Values
      7. Duplicate Instances and/or Features
      8. Bad Feature Selection
      9. Activity 7: Determining Which Features to Visualize on a Scatter Plot
    3. Data Visualization
      1. Choosing a Visualization
      2. Common Pitfalls While Visualizing Data
      3. Exercise 55: Creating a Confusing Visualization
      4. Activity 8: Creating a Bar Graph for Improving a Visualization
    4. Cheat Sheet for the Visualization Process
    5. Summary
  9. Appendix
    1. 1. Introduction to Visualization with Python – Basic and Customized Plotting
      1. Activity 1: Analyzing Different Scenarios and Generating the Appropriate Visualization
      2. Solution
    2. 2. Static Visualization – Global Patterns and Summary Statistics
      1. Activity 2: Design Static Visualization to Present Global Patterns and Summary Statistics
      2. Solution
    3. 3. From Static to Interactive Visualization
      1. Activity 3: Creating Different Interactive Visualizations Using Plotly Express
      2. Solution
    4. 4. Interactive Visualization of Data across Strata
      1. Activity 4: Generate a Bar Plot and a Heatmap to Represent Content Rating Types in the Google Play Store Apps Dataset
    5. 5. Interactive Visualization of Data across Time
      1. Activity 5: Create an Interactive Temporal Visualization using RangeTool and Aggregator
    6. 6. Interactive Visualizations of Data across Geographical Regions
      1. Activity 6: Creating a Choropleth Map to Represent Total Renewable Energy Production and Consumption across the World
      2. Solution
    7. 7. Avoiding Common Pitfalls to Create Interactive Visualizations
      1. Activity 7: Determining Which Features to Visualize on a Scatter Plot
      2. Activity 8: Creating a Bar Graph for Improving a Visualization

Product information

  • Title: Interactive Data Visualization with Python - Second Edition
  • Author(s): Abha Belorkar, Sharath Chandra Guntuku, Shubhangi Hora, Anshu Kumar
  • Release date: April 2020
  • Publisher(s): Packt Publishing
  • ISBN: 9781800200944