Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Data Visualization with Bokeh

You're reading from   Hands-On Data Visualization with Bokeh Interactive web plotting for Python using Bokeh

Arrow left icon
Product type Book
Published in Jun 2018
Publisher Packt
ISBN-13 9781789135404
Pages 174 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Kevin Jolly Kevin Jolly
Author Profile Icon Kevin Jolly
Kevin Jolly
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Bokeh Installation and Key Concepts FREE CHAPTER 2. Plotting using Glyphs 3. Plotting with different Data Structures 4. Using Layouts for Effective Presentation 5. Using Annotations, Widgets, and Visual Attributes for Visual Enhancement 6. Building and Hosting Applications Using the Bokeh Server 7. Advanced Plotting with Networks, Geo Data, WebGL, and Exporting Plots 8. The Bokeh Workflow – A Case Study 9. Other Books You May Enjoy

Creating plots using NumPy arrays

NumPy arrays are one of the most fundamental data structures found in Python and as such are an important data structure when it comes to creating interactive visualizations in Bokeh. In this section, we will cover how you can build line and scatter plots using NumPy arrays.

Creating line plots using NumPy arrays

In order to create a simple line plot using a NumPy array, we can use this code:

#Import required packages

import numpy as np
import random
from bokeh.io import output_file, show
from bokeh.plotting import figure

#Creating an array for the points along the x and y axes

array_x =np.array([1,2,3,4,5,6])

array_y = np.array([5,6,7,8,9,10])

#Creating a line plot

plot = figure()

plot.line(array_x...
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