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! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Hands-On Data Visualization with Bokeh
Hands-On Data Visualization with Bokeh

Hands-On Data Visualization with Bokeh: Interactive web plotting for Python using Bokeh

eBook
€8.99 €19.99
Paperback
€24.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Hands-On Data Visualization with Bokeh

Plotting using Glyphs

Glyphs are the fundamental building blocks of Bokeh and are used to create a wide variety of plots. In fact, every single plot that you build while working with Bokeh has a glyph mechanism attached to it, such as lines, rectangles, circles, and any other object that makes up the plot.

In this chapter, you will learn about the following topics:

  • What glyphs are
  • How you can plot with glyphs
  • How to create scatter plots using glyphs
  • How you can customize glyphs

Technical requirements

What are glyphs?

When you see a plot, interactive or not, it is usually composed of geometric shapes that make up every element in that plot. In Bokeh, these geometric shapes are called glyphs. If we wanted to create a line plot, we would have to use a line to represent information on the plot, and if we wanted to create a scatter plot with a circle as our marker, we would use a circle to represent that information.

These geometric shapes that are used to convey visual information to readers about a piece of data are called glyphs.

In this book, we will help you plot the four types of plot where above using glyphs, and we will also give you information on the various types of plot that can be plotted using glyphs.

Plotting with glyphs

In this section, we will learn how to plot the following types of plot using glyphs:

  • Line plots: Line plots offer a way of visualizing the movements of points along the x-and y-axes in the form of a line. These plots are useful for performing time series analytics.
  • Bar plots: Bar plots are useful for indicating the count of each category of a particular column or field in your dataset.
  • Patch plots: Patch plots are used to indicate a region of points in a particular shade of color. Such plots can be used to distinguish different groups within the same dataset.
  • Scatter plots: Scatter plots are used to visualize the relationship between two variables and to indicate the strength of correlation between them.

Creating line plots

...

Customizing glyphs

When creating the preceding scatter plot, we used the circle marker to indicate the points on the plot. Bokeh provides us with a wide variety of markers that you can use instead of the circle, and they are as follows:

- cross()
- x()
- diamond()
- diamond_cross()
- circle_x()
- circle_cross()
- triangle()
- inverted_triangle()
- square()
- square_x()
- square_cross()
- asterisk()

You can also add labels to the x-and y-axes by using the following code:

plot.figure(x_axis_label = "Label name of x axis", y_axis_label = "Label name of y axis")

You can customize the transparency of the points on a scatter plot by using the following code:

plot.circle(x, y, alpha = 0.5)

The alpha argument takes in a range of values between 0 to 1, with 0 being completely transparent and 1 being opaque.

Summary

This chapter has given you an introduction to what glyphs are and how you can use them to create fundamental plots using Bokeh. We also looked at how to customize these plots further.

Glyphs are the fundamental building blocks of Bokeh and are required in order to create more complex, and statistically significant, plots in the future.

In this chapter, you learned how to create four different plots using glyphs. Line plots are commonly used in time series analytics, bar plots are commonly used to compare counts between different categories, patch plots are commonly used to highlight an area of points, and scatter plots, are commonly used to map a relationship between two or more variables.

In the upcoming chapter, we will take these concepts and use them to plot diagrams using NumPy arrays and Pandas DataFrames.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • A step by step approach to creating interactive plots with Bokeh
  • Go from installation all the way to deploying your very own Bokeh application
  • Work with a real time datasets to practice and create your very own plots and applications

Description

Adding a layer of interactivity to your plots and converting these plots into applications hold immense value in the field of data science. The standard approach to adding interactivity would be to use paid software such as Tableau, but the Bokeh package in Python offers users a way to create both interactive and visually aesthetic plots for free. This book gets you up to speed with Bokeh - a popular Python library for interactive data visualization. The book starts out by helping you understand how Bokeh works internally and how you can set up and install the package in your local machine. You then use a real world data set which uses stock data from Kaggle to create interactive and visually stunning plots. You will also learn how to leverage Bokeh using some advanced concepts such as plotting with spatial and geo data. Finally you will use all the concepts that you have learned in the previous chapters to create your very own Bokeh application from scratch. By the end of the book you will be able to create your very own Bokeh application. You will have gone through a step by step process that starts with understanding what Bokeh actually is and ends with building your very own Bokeh application filled with interactive and visually aesthetic plots.

Who is this book for?

This book is well suited for data scientists and data analysts who want to perform interactive data visualization on their web browsers using Bokeh. Some exposure to Python programming will be helpful, but prior experience with Bokeh is not required.

What you will learn

  • Installing Bokeh and understanding its key concepts
  • Creating plots using glyphs, the fundamental building blocks of Bokeh
  • Creating plots using different data structures like NumPy and Pandas
  • Using layouts and widgets to visually enhance your plots and add a layer of interactivity
  • Building and hosting applications on the Bokeh server
  • Creating advanced plots using spatial data
Estimated delivery fee Deliver to Lithuania

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 15, 2018
Length: 174 pages
Edition : 1st
Language : English
ISBN-13 : 9781789135404
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Lithuania

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Publication date : Jun 15, 2018
Length: 174 pages
Edition : 1st
Language : English
ISBN-13 : 9781789135404
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 79.97
Hands-On Data Science with Anaconda
€29.99
Hands-On Data Visualization with Bokeh
€24.99
Hands-On Data Analysis with NumPy and pandas
€24.99
Total 79.97 Stars icon
Banner background image

Table of Contents

9 Chapters
Bokeh Installation and Key Concepts Chevron down icon Chevron up icon
Plotting using Glyphs Chevron down icon Chevron up icon
Plotting with different Data Structures Chevron down icon Chevron up icon
Using Layouts for Effective Presentation Chevron down icon Chevron up icon
Using Annotations, Widgets, and Visual Attributes for Visual Enhancement Chevron down icon Chevron up icon
Building and Hosting Applications Using the Bokeh Server Chevron down icon Chevron up icon
Advanced Plotting with Networks, Geo Data, WebGL, and Exporting Plots Chevron down icon Chevron up icon
The Bokeh Workflow – A Case Study Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.7
(6 Ratings)
5 star 50%
4 star 0%
3 star 33.3%
2 star 0%
1 star 16.7%
Filter icon Filter
Top Reviews

Filter reviews by




jose Aug 05, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Easy to follow
Amazon Verified review Amazon
R. Millikan Sep 26, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is a really good book for getting someone started with Bokeh. Their is soooo much more to learn, but it is a very good start
Amazon Verified review Amazon
Hernán Díaz Dec 28, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Muy buen libro, es un poco corto pero va directo al grano con lo importante y te enseña lo suficiente para que se pueda continuar por uno mismo
Amazon Verified review Amazon
John Coleman May 06, 2019
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
The book is a quick read and is useful for getting up and running with Bokeh, but it is woefully incomplete and has some occasional technical errors.As a glaring example of the incompleteness, the book gives very, very little guidance about the handling of color (which is a major topic in any graphing library). It illustrates uses of color words such as color = 'red' , but has no discussion of issues like: which color words can you use? Where can you find a list? How could you specify a color using RGB or HSL or color hex strings? It illustrates CategoricalColorMapper (applied to a hard-wired two color palette) but has zero discussion or even mention of LinearColorMapper and LogColorMapper for continuous data or other options for color palettes (such as the rich built-in set of palettes). And even though it mentions color mapping, it doesn't say anything at all about color bars which provide a legend for the meaning of colors. These are all things I had to learn on my own from other sources (such as Stack Overflow) while reading this book. There were numerous other cases where relatively basic questions which naturally arose when reading the book were left unanswered in the book itself. I have illustrated the incompleteness with color, but I could also mention e.g. tools. It has a decent but still incomplete discussion of hover tools but its discussion of other tools ranges from nonexistent to cursory.As far as technical errors, there aren't too many but there are some. For example, on page 25 it says that "You can also add labels to the x- and y-axis by using the following code: plot.figure(x_axis_label = ..." but -- you can't. Using the author's code yields AttributeError: 'Figure' object has no attribute 'figure'. The fix isn't hard -- but is to be found on Stack Overflow (or the online documentation) rather than the book itself.On the plus side, the book does a good job in explaining how Bokeh plays nicely with pandas and numpy and is reasonably well written. For this reason, it deserves more than one or two stars. If you want a quick start which will give you a basic orientation to Bokeh in just a few days, I recommend this book. But, if you want to learn to make sophisticated graphs with Bokeh, this isn't your guide.
Amazon Verified review Amazon
SJ Oct 10, 2018
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
This book gives a quick intro to bokeh. It does not go indepth into the more complex uses of bokeh. You should really use this in conjunction with the online bokeh.pydata.org resource to fill out the missing pieces etc. Because I like to know the structure of the data I am using and the data structure required by various 'platforms', it would have been helpful if samples of the data sets used eg the SP500 data were given. This data is given in a separate chapter at the end, but as the tech requirements are always repeated at the beginning of each chapter and section, I dont see why sample data structure cannot also be shown. This would give the reader a better appreciation for the method and arguments used. The book is also a little thin on graphing networks and geo data, hopefully the next edition might beef up this chapter considerably. I give this an average rating.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela