Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Interactive Data Visualization with Python

You're reading from   Interactive Data Visualization with Python Present your data as an effective and compelling story

Arrow left icon
Product type Paperback
Published in Apr 2020
Publisher
ISBN-13 9781800200944
Length 362 pages
Edition 2nd Edition
Languages
Arrow right icon
Authors (4):
Arrow left icon
Shubhangi Hora Shubhangi Hora
Author Profile Icon Shubhangi Hora
Shubhangi Hora
Abha Belorkar Abha Belorkar
Author Profile Icon Abha Belorkar
Abha Belorkar
Anshu Kumar Anshu Kumar
Author Profile Icon Anshu Kumar
Anshu Kumar
Sharath Chandra Guntuku Sharath Chandra Guntuku
Author Profile Icon Sharath Chandra Guntuku
Sharath Chandra Guntuku
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Introduction to Visualization with Python – Basic and Customized Plotting 2. Static Visualization – Global Patterns and Summary Statistics FREE CHAPTER 3. From Static to Interactive Visualization 4. Interactive Visualization of Data across Strata 5. Interactive Visualization of Data across Time 6. Interactive Visualization of Geographical Data 7. Avoiding Common Pitfalls to Create Interactive Visualizations Appendix

5. Interactive Visualization of Data across Time

Activity 5: Create an Interactive Temporal Visualization using RangeTool and Aggregator

  1. Import required libraries:
    from bokeh.io import show
    from bokeh.layouts import column
    from bokeh.models import ColumnDataSource, RangeTool
    from bokeh.plotting import figure
    from bokeh.io import push_notebook, show, output_notebook
    from pathlib import Path
    import pandas as pd
    import numpy as np
    from ipywidgets import interact
    %matplotlib inline
  2. Setup the output to Jupyter Notebook:
    DATA_PATH = Path(“../datasets/chap5_data/”)
    output_notebook()
  3. Create a DataFrame microsoft_df and parse the date column:
    microsoft_df = pd.read_csv(DATA_PATH / “microsoft_stock.csv”, parse_dates=[‘date’])
  4. Set the index as date:
    microsoft_df.index = microsoft_df.date
  5. Create date numpy array and source as ColumnDataSource. We will use these to draw line plot:
    dates = np.array(microsoft_df...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime