SlideShare a Scribd company logo
Data Visualization in Python
Marc Garcia - @datapythonista
Data Visualisation Summit - London, 2017
1 / 34
Data Visualization in Python - @datapythonista
About me
http://datapythonista.github.io
2 / 34
Data Visualization in Python - @datapythonista
Python for data science
3 / 34
Data Visualization in Python - @datapythonista
Python for data science
Why Python?
Python is the favorite of many:
Fast to write: Batteries included
Easy to read: Readability is KEY
Excellent community: Conferences, local groups, stackoverflow...
Ubiquitous: Present in all major platforms
Easy to integrate: Implements main protocols and formats
Easy to extend: C extensions for low-level operations
4 / 34
Data Visualization in Python - @datapythonista
Python for data science
Python performance
Is Python fast for data science?
Short answer: No
Long answer: Yes
numpy
Cython
C extensions
Numba
etc.
5 / 34
Data Visualization in Python - @datapythonista
Python for data science
Python is great for data science
A whole ecosystem exists:
numpy
scipy
pandas
statsmodels
scikit-learn
etc.
6 / 34
Data Visualization in Python - @datapythonista
Python for data science
Python environment
One ring to rule them all:
7 / 34
Data Visualization in Python - @datapythonista
Python for data science
Python platform
Jupyter notebook
8 / 34
Data Visualization in Python - @datapythonista
Python for data science
Python for visualization
Main libraries:
Matplotlib
Seaborn
Bokeh
HoloViews
Datashader
Domain-specific
Folium: maps
yt: volumetric data
9 / 34
Data Visualization in Python - @datapythonista
Visualization tools
10 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Matplotlib
First Python visualization tool
Still a de-facto standard
Replicates Matlab API
Supports many backends
11 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Matplotlib
import numpy
from matplotlib import pyplot
x = numpy.linspace(0., 100., 1001)
y = x + numpy.random.randn(1001) * 5
pyplot.plot(x, y)
pyplot.xlabel(’time (seconds)’)
pyplot.ylabel(’some noisy signal’)
pyplot.title(’A simple plot in matplotlib’)
12 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Matplotlib
13 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Matplotlib
import numpy
from matplotlib import pyplot
x = numpy.linspace(0., 100., 1001)
y1 = x + numpy.random.randn(1001) * 3
y2 = 45 + x * .4 + numpy.random.randn(1001) * 7
pyplot.plot(x, y1, label=’Our previous signal’)
pyplot.plot(x, y2, color=’orange’, label=’A new signal’)
pyplot.xlabel(’time (seconds)’)
pyplot.ylabel(’some noisy signal’)
pyplot.title(’A simple plot in matplotlib’)
pyplot.legend()
14 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Matplotlib
15 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Seaborn
Matplotlib wrapper
Built-in themes
Higher level plots:
Heatmap
Violin plot
Pair plot
16 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Seaborn
from matplotlib import pyplot
import seaborn
flights_flat = seaborn.load_dataset(’flights’)
flights = flights_flat.pivot(’month’, ’year’, ’passengers’)
seaborn.heatmap(flights, annot=True, fmt=’d’)
pyplot.title(’Number of flight passengers (thousands)’)
17 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Seaborn
18 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Bokeh
Client-server architecture: JavaScript front-end
Interactive
Drawing shapes to generate plots
19 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Bokeh
Demo
20 / 34
Data Visualization in Python - @datapythonista
Visualization tools
HoloViews
Bokeh wrapper
Higher level plots
Mainly for Bokeh, but other backends supported
21 / 34
Data Visualization in Python - @datapythonista
Visualization tools
HoloViews
import numpy as np
import holoviews as hv
from bokeh.sampledata.us_counties import data as counties
from bokeh.sampledata.unemployment import data as unemployment
hv.extension(’bokeh’)
counties = {code: county for code, county in counties.items() if county[’state’] == ’tx’}
county_xs = [county[’lons’] for county in counties.values()]
county_ys = [county[’lats’] for county in counties.values()]
county_names = [county[’name’] for county in counties.values()]
county_rates = [unemployment[county_id] for county_id in counties]
county_polys = {name: hv.Polygons((xs, ys), level=rate, vdims=[’Unemployment’])
for name, xs, ys, rate in zip(county_names, county_xs, county_ys,
county_rates)}
choropleth = hv.NdOverlay(county_polys, kdims=[’County’])
plot_opts = dict(logz=True, tools=[’hover’], xaxis=None, yaxis=None,
show_grid=False, show_frame=False, width=500, height=500)
style = dict(line_color=’white’)
choropleth({’Polygons’: {’style’: style, ’plot’: plot_opts}})
22 / 34
Data Visualization in Python - @datapythonista
Visualization tools
HoloViews
23 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Datashader
Bokeh wrapper
Built for big data
Advanced subsampling and binning techniques
24 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Datashader
25 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Folium
Visualization of maps
Compatible with Google maps and Open street maps
Visualization of markers, paths and polygons
26 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Folium
import folium
m = folium.Map(location=[45.372, -121.6972],
zoom_start=12,
tiles=’Stamen Terrain’)
folium.Marker(location=[45.3288, -121.6625],
popup=’Mt. Hood Meadows’,
icon=folium.Icon(icon=’cloud’)).add_to(m)
folium.Marker(location=[45.3311, -121.7113],
popup=’Timberline Lodge’,
icon=folium.Icon(color=’green’)).add_to(m)
folium.Marker(location=[45.3300, -121.6823],
popup=’Some Other Location’,
icon=folium.Icon(color=’red’, icon=’info-sign’)).add_to(m)
m
27 / 34
Data Visualization in Python - @datapythonista
Visualization tools
Folium
28 / 34
Data Visualization in Python - @datapythonista
Visualization tools
yt
Visualization of volumetric data
Compatible with many formats
Projects multidimensional data to a 2-D plane
29 / 34
Data Visualization in Python - @datapythonista
Visualization tools
yt
import yt
ds = yt.load(’MOOSE_sample_data/out.e-s010’)
sc = yt.create_scene(ds)
ms = sc.get_source()
ms.cmap = ’Eos A’
cam = sc.camera
cam.focus = ds.arr([0.0, 0.0, 0.0], ’code_length’)
cam_pos = ds.arr([-3.0, 3.0, -3.0], ’code_length’)
north_vector = ds.arr([0.0, -1.0, -1.0], ’dimensionless’)
cam.set_position(cam_pos, north_vector)
cam.resolution = (800, 800)
sc.save()
30 / 34
Data Visualization in Python - @datapythonista
Visualization tools
yt
31 / 34
Data Visualization in Python - @datapythonista
Conclusions
32 / 34
Data Visualization in Python - @datapythonista
Conclusions
Conclusions
Python is great as a programming language
And is great for data science
Plenty of options for visualization:
Standard plots
Ad-hoc plots
Interactive
3D plots
Maps
Big data
Specialized
33 / 34
Data Visualization in Python - @datapythonista
Conclusions
Questions?
@datapythonista
34 / 34
Data Visualization in Python - @datapythonista

More Related Content

What's hot (20)

Data Analysis and Visualization using Python
Data Analysis and Visualization using PythonData Analysis and Visualization using Python
Data Analysis and Visualization using Python
Chariza Pladin
 
Introduction to matplotlib
Introduction to matplotlibIntroduction to matplotlib
Introduction to matplotlib
Piyush rai
 
Python for Data Science
Python for Data SciencePython for Data Science
Python for Data Science
Harri Hämäläinen
 
Basic of python for data analysis
Basic of python for data analysisBasic of python for data analysis
Basic of python for data analysis
Pramod Toraskar
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming ppt
ismailmrribi
 
Data Visualization(s) Using Python
Data Visualization(s) Using PythonData Visualization(s) Using Python
Data Visualization(s) Using Python
Aniket Maithani
 
Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming Language
Tahani Al-Manie
 
Data preprocessing in Machine learning
Data preprocessing in Machine learning Data preprocessing in Machine learning
Data preprocessing in Machine learning
pyingkodi maran
 
Python NumPy Tutorial | NumPy Array | Edureka
Python NumPy Tutorial | NumPy Array | EdurekaPython NumPy Tutorial | NumPy Array | Edureka
Python NumPy Tutorial | NumPy Array | Edureka
Edureka!
 
Introduction to pandas
Introduction to pandasIntroduction to pandas
Introduction to pandas
Piyush rai
 
programming with python ppt
programming with python pptprogramming with python ppt
programming with python ppt
Priyanka Pradhan
 
Python ppt
Python pptPython ppt
Python ppt
Mohita Pandey
 
Introduction to R Graphics with ggplot2
Introduction to R Graphics with ggplot2Introduction to R Graphics with ggplot2
Introduction to R Graphics with ggplot2
izahn
 
Python PPT
Python PPTPython PPT
Python PPT
Edureka!
 
Intro to Jupyter Notebooks
Intro to Jupyter NotebooksIntro to Jupyter Notebooks
Intro to Jupyter Notebooks
Francis Michael Bautista
 
Operators in python
Operators in pythonOperators in python
Operators in python
Prabhakaran V M
 
Machine Learning and its Applications
Machine Learning and its ApplicationsMachine Learning and its Applications
Machine Learning and its Applications
Dr Ganesh Iyer
 
Python Programming Language | Python Classes | Python Tutorial | Python Train...
Python Programming Language | Python Classes | Python Tutorial | Python Train...Python Programming Language | Python Classes | Python Tutorial | Python Train...
Python Programming Language | Python Classes | Python Tutorial | Python Train...
Edureka!
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
 
Data Science With Python | Python For Data Science | Python Data Science Cour...
Data Science With Python | Python For Data Science | Python Data Science Cour...Data Science With Python | Python For Data Science | Python Data Science Cour...
Data Science With Python | Python For Data Science | Python Data Science Cour...
Simplilearn
 
Data Analysis and Visualization using Python
Data Analysis and Visualization using PythonData Analysis and Visualization using Python
Data Analysis and Visualization using Python
Chariza Pladin
 
Introduction to matplotlib
Introduction to matplotlibIntroduction to matplotlib
Introduction to matplotlib
Piyush rai
 
Basic of python for data analysis
Basic of python for data analysisBasic of python for data analysis
Basic of python for data analysis
Pramod Toraskar
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming ppt
ismailmrribi
 
Data Visualization(s) Using Python
Data Visualization(s) Using PythonData Visualization(s) Using Python
Data Visualization(s) Using Python
Aniket Maithani
 
Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming Language
Tahani Al-Manie
 
Data preprocessing in Machine learning
Data preprocessing in Machine learning Data preprocessing in Machine learning
Data preprocessing in Machine learning
pyingkodi maran
 
Python NumPy Tutorial | NumPy Array | Edureka
Python NumPy Tutorial | NumPy Array | EdurekaPython NumPy Tutorial | NumPy Array | Edureka
Python NumPy Tutorial | NumPy Array | Edureka
Edureka!
 
Introduction to pandas
Introduction to pandasIntroduction to pandas
Introduction to pandas
Piyush rai
 
programming with python ppt
programming with python pptprogramming with python ppt
programming with python ppt
Priyanka Pradhan
 
Introduction to R Graphics with ggplot2
Introduction to R Graphics with ggplot2Introduction to R Graphics with ggplot2
Introduction to R Graphics with ggplot2
izahn
 
Python PPT
Python PPTPython PPT
Python PPT
Edureka!
 
Machine Learning and its Applications
Machine Learning and its ApplicationsMachine Learning and its Applications
Machine Learning and its Applications
Dr Ganesh Iyer
 
Python Programming Language | Python Classes | Python Tutorial | Python Train...
Python Programming Language | Python Classes | Python Tutorial | Python Train...Python Programming Language | Python Classes | Python Tutorial | Python Train...
Python Programming Language | Python Classes | Python Tutorial | Python Train...
Edureka!
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
 
Data Science With Python | Python For Data Science | Python Data Science Cour...
Data Science With Python | Python For Data Science | Python Data Science Cour...Data Science With Python | Python For Data Science | Python Data Science Cour...
Data Science With Python | Python For Data Science | Python Data Science Cour...
Simplilearn
 

Similar to Data visualization in Python (20)

datavisualizationinpythonv2-171103225436.pdf
datavisualizationinpythonv2-171103225436.pdfdatavisualizationinpythonv2-171103225436.pdf
datavisualizationinpythonv2-171103225436.pdf
smartashammari
 
Scientific Plotting in Python
Scientific Plotting in PythonScientific Plotting in Python
Scientific Plotting in Python
Jack Parmer
 
A Data Science Tutorial in Python
A Data Science Tutorial in PythonA Data Science Tutorial in Python
A Data Science Tutorial in Python
Ajay Ohri
 
Python Pyplot Class XII
Python Pyplot Class XIIPython Pyplot Class XII
Python Pyplot Class XII
ajay_opjs
 
End-to-end Big Data Projects with Python - StampedeCon Big Data Conference 2017
End-to-end Big Data Projects with Python - StampedeCon Big Data Conference 2017End-to-end Big Data Projects with Python - StampedeCon Big Data Conference 2017
End-to-end Big Data Projects with Python - StampedeCon Big Data Conference 2017
StampedeCon
 
Python webinar 4th june
Python webinar 4th junePython webinar 4th june
Python webinar 4th june
Edureka!
 
Webinar: Mastering Python - An Excellent tool for Web Scraping and Data Anal...
Webinar:  Mastering Python - An Excellent tool for Web Scraping and Data Anal...Webinar:  Mastering Python - An Excellent tool for Web Scraping and Data Anal...
Webinar: Mastering Python - An Excellent tool for Web Scraping and Data Anal...
Edureka!
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data Analytics
Edureka!
 
The Quest for an Open Source Data Science Platform
 The Quest for an Open Source Data Science Platform The Quest for an Open Source Data Science Platform
The Quest for an Open Source Data Science Platform
QAware GmbH
 
Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017
Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017
Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017
Codemotion
 
Power of Python with Big Data
Power of Python with Big DataPower of Python with Big Data
Power of Python with Big Data
Edureka!
 
(ATS6-PLAT03) What's behind Discngine collections
(ATS6-PLAT03) What's behind Discngine collections(ATS6-PLAT03) What's behind Discngine collections
(ATS6-PLAT03) What's behind Discngine collections
BIOVIA
 
Data science apps: beyond notebooks
Data science apps: beyond notebooksData science apps: beyond notebooks
Data science apps: beyond notebooks
Natalino Busa
 
Sci computing using python
Sci computing using pythonSci computing using python
Sci computing using python
Ashok Govindarajan
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data Analytics
Edureka!
 
Reproducible Workflow with Cytoscape and Jupyter Notebook
Reproducible Workflow with Cytoscape and Jupyter NotebookReproducible Workflow with Cytoscape and Jupyter Notebook
Reproducible Workflow with Cytoscape and Jupyter Notebook
Keiichiro Ono
 
Turbocharge your data science with python and r
Turbocharge your data science with python and rTurbocharge your data science with python and r
Turbocharge your data science with python and r
Kelli-Jean Chun
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Rajesh Rajamani
 
Anaconda and PyData Solutions
Anaconda and PyData SolutionsAnaconda and PyData Solutions
Anaconda and PyData Solutions
Travis Oliphant
 
Python ml
Python mlPython ml
Python ml
Shubham Sharma
 
datavisualizationinpythonv2-171103225436.pdf
datavisualizationinpythonv2-171103225436.pdfdatavisualizationinpythonv2-171103225436.pdf
datavisualizationinpythonv2-171103225436.pdf
smartashammari
 
Scientific Plotting in Python
Scientific Plotting in PythonScientific Plotting in Python
Scientific Plotting in Python
Jack Parmer
 
A Data Science Tutorial in Python
A Data Science Tutorial in PythonA Data Science Tutorial in Python
A Data Science Tutorial in Python
Ajay Ohri
 
Python Pyplot Class XII
Python Pyplot Class XIIPython Pyplot Class XII
Python Pyplot Class XII
ajay_opjs
 
End-to-end Big Data Projects with Python - StampedeCon Big Data Conference 2017
End-to-end Big Data Projects with Python - StampedeCon Big Data Conference 2017End-to-end Big Data Projects with Python - StampedeCon Big Data Conference 2017
End-to-end Big Data Projects with Python - StampedeCon Big Data Conference 2017
StampedeCon
 
Python webinar 4th june
Python webinar 4th junePython webinar 4th june
Python webinar 4th june
Edureka!
 
Webinar: Mastering Python - An Excellent tool for Web Scraping and Data Anal...
Webinar:  Mastering Python - An Excellent tool for Web Scraping and Data Anal...Webinar:  Mastering Python - An Excellent tool for Web Scraping and Data Anal...
Webinar: Mastering Python - An Excellent tool for Web Scraping and Data Anal...
Edureka!
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data Analytics
Edureka!
 
The Quest for an Open Source Data Science Platform
 The Quest for an Open Source Data Science Platform The Quest for an Open Source Data Science Platform
The Quest for an Open Source Data Science Platform
QAware GmbH
 
Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017
Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017
Data Science Apps: Beyond Notebooks - Natalino Busa - Codemotion Amsterdam 2017
Codemotion
 
Power of Python with Big Data
Power of Python with Big DataPower of Python with Big Data
Power of Python with Big Data
Edureka!
 
(ATS6-PLAT03) What's behind Discngine collections
(ATS6-PLAT03) What's behind Discngine collections(ATS6-PLAT03) What's behind Discngine collections
(ATS6-PLAT03) What's behind Discngine collections
BIOVIA
 
Data science apps: beyond notebooks
Data science apps: beyond notebooksData science apps: beyond notebooks
Data science apps: beyond notebooks
Natalino Busa
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data Analytics
Edureka!
 
Reproducible Workflow with Cytoscape and Jupyter Notebook
Reproducible Workflow with Cytoscape and Jupyter NotebookReproducible Workflow with Cytoscape and Jupyter Notebook
Reproducible Workflow with Cytoscape and Jupyter Notebook
Keiichiro Ono
 
Turbocharge your data science with python and r
Turbocharge your data science with python and rTurbocharge your data science with python and r
Turbocharge your data science with python and r
Kelli-Jean Chun
 
Anaconda and PyData Solutions
Anaconda and PyData SolutionsAnaconda and PyData Solutions
Anaconda and PyData Solutions
Travis Oliphant
 
Ad

More from Marc Garcia (6)

Replicating the human brain: Deep learning in action
Replicating the human brain: Deep learning in actionReplicating the human brain: Deep learning in action
Replicating the human brain: Deep learning in action
Marc Garcia
 
Machine Learning for Digital Advertising
Machine Learning for Digital AdvertisingMachine Learning for Digital Advertising
Machine Learning for Digital Advertising
Marc Garcia
 
Machine learning for digital advertising
Machine learning for digital advertisingMachine learning for digital advertising
Machine learning for digital advertising
Marc Garcia
 
Understanding random forests
Understanding random forestsUnderstanding random forests
Understanding random forests
Marc Garcia
 
CART: Not only Classification and Regression Trees
CART: Not only Classification and Regression TreesCART: Not only Classification and Regression Trees
CART: Not only Classification and Regression Trees
Marc Garcia
 
High Performance Python - Marc Garcia
High Performance Python - Marc GarciaHigh Performance Python - Marc Garcia
High Performance Python - Marc Garcia
Marc Garcia
 
Replicating the human brain: Deep learning in action
Replicating the human brain: Deep learning in actionReplicating the human brain: Deep learning in action
Replicating the human brain: Deep learning in action
Marc Garcia
 
Machine Learning for Digital Advertising
Machine Learning for Digital AdvertisingMachine Learning for Digital Advertising
Machine Learning for Digital Advertising
Marc Garcia
 
Machine learning for digital advertising
Machine learning for digital advertisingMachine learning for digital advertising
Machine learning for digital advertising
Marc Garcia
 
Understanding random forests
Understanding random forestsUnderstanding random forests
Understanding random forests
Marc Garcia
 
CART: Not only Classification and Regression Trees
CART: Not only Classification and Regression TreesCART: Not only Classification and Regression Trees
CART: Not only Classification and Regression Trees
Marc Garcia
 
High Performance Python - Marc Garcia
High Performance Python - Marc GarciaHigh Performance Python - Marc Garcia
High Performance Python - Marc Garcia
Marc Garcia
 
Ad

Recently uploaded (20)

aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjaraswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
muhammadalikhanalikh1
 
UberEats clone app Development TechBuilder
UberEats clone app Development  TechBuilderUberEats clone app Development  TechBuilder
UberEats clone app Development TechBuilder
TechBuilder
 
Topic 26 Security Testing Considerations.pptx
Topic 26 Security Testing Considerations.pptxTopic 26 Security Testing Considerations.pptx
Topic 26 Security Testing Considerations.pptx
marutnand8
 
SQL-COMMANDS instructionsssssssssss.pptx
SQL-COMMANDS instructionsssssssssss.pptxSQL-COMMANDS instructionsssssssssss.pptx
SQL-COMMANDS instructionsssssssssss.pptx
Ashlei5
 
Issues in AI Presentation and machine learning.pptx
Issues in AI Presentation and machine learning.pptxIssues in AI Presentation and machine learning.pptx
Issues in AI Presentation and machine learning.pptx
Jalalkhan657136
 
How a Staff Augmentation Company IN USA Powers Flutter App Breakthroughs.pdf
How a Staff Augmentation Company IN USA Powers Flutter App Breakthroughs.pdfHow a Staff Augmentation Company IN USA Powers Flutter App Breakthroughs.pdf
How a Staff Augmentation Company IN USA Powers Flutter App Breakthroughs.pdf
mary rojas
 
Top 10 Mobile Banking Apps in the USA.pdf
Top 10 Mobile Banking Apps in the USA.pdfTop 10 Mobile Banking Apps in the USA.pdf
Top 10 Mobile Banking Apps in the USA.pdf
LL Technolab
 
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdfBoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
Ortus Solutions, Corp
 
Oliveira2024 - Combining GPT and Weak Supervision.pdf
Oliveira2024 - Combining GPT and Weak Supervision.pdfOliveira2024 - Combining GPT and Weak Supervision.pdf
Oliveira2024 - Combining GPT and Weak Supervision.pdf
GiliardGodoi1
 
Techdebt handling with cleancode focus and as risk taker
Techdebt handling with cleancode focus and as risk takerTechdebt handling with cleancode focus and as risk taker
Techdebt handling with cleancode focus and as risk taker
RajaNagendraKumar
 
War Story: Removing Offensive Language from Percona Toolkit
War Story: Removing Offensive Language from Percona ToolkitWar Story: Removing Offensive Language from Percona Toolkit
War Story: Removing Offensive Language from Percona Toolkit
Sveta Smirnova
 
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROIAutoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Udit Goenka
 
Feeling Lost in the Blue? Exploring a New Path: AI Mental Health Counselling ...
Feeling Lost in the Blue? Exploring a New Path: AI Mental Health Counselling ...Feeling Lost in the Blue? Exploring a New Path: AI Mental Health Counselling ...
Feeling Lost in the Blue? Exploring a New Path: AI Mental Health Counselling ...
officeiqai
 
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Prachi Desai
 
iOS Developer Resume 2025 | Pramod Kumar
iOS Developer Resume 2025 | Pramod KumariOS Developer Resume 2025 | Pramod Kumar
iOS Developer Resume 2025 | Pramod Kumar
Pramod Kumar
 
zOS CommServer support for the Network Express feature on z17
zOS CommServer support for the Network Express feature on z17zOS CommServer support for the Network Express feature on z17
zOS CommServer support for the Network Express feature on z17
zOSCommserver
 
grade 9 ai project cycle Artificial intelligence.pptx
grade 9 ai project cycle Artificial intelligence.pptxgrade 9 ai project cycle Artificial intelligence.pptx
grade 9 ai project cycle Artificial intelligence.pptx
manikumar465287
 
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...
Philip Schwarz
 
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdfSecure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Northwind Technologies
 
Optimising Claims Management with Claims Processing Systems
Optimising Claims Management with Claims Processing SystemsOptimising Claims Management with Claims Processing Systems
Optimising Claims Management with Claims Processing Systems
Insurance Tech Services
 
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjaraswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
aswjkdwelhjdfshlfjkhewljhfljawerhwjarhwjkahrjar
muhammadalikhanalikh1
 
UberEats clone app Development TechBuilder
UberEats clone app Development  TechBuilderUberEats clone app Development  TechBuilder
UberEats clone app Development TechBuilder
TechBuilder
 
Topic 26 Security Testing Considerations.pptx
Topic 26 Security Testing Considerations.pptxTopic 26 Security Testing Considerations.pptx
Topic 26 Security Testing Considerations.pptx
marutnand8
 
SQL-COMMANDS instructionsssssssssss.pptx
SQL-COMMANDS instructionsssssssssss.pptxSQL-COMMANDS instructionsssssssssss.pptx
SQL-COMMANDS instructionsssssssssss.pptx
Ashlei5
 
Issues in AI Presentation and machine learning.pptx
Issues in AI Presentation and machine learning.pptxIssues in AI Presentation and machine learning.pptx
Issues in AI Presentation and machine learning.pptx
Jalalkhan657136
 
How a Staff Augmentation Company IN USA Powers Flutter App Breakthroughs.pdf
How a Staff Augmentation Company IN USA Powers Flutter App Breakthroughs.pdfHow a Staff Augmentation Company IN USA Powers Flutter App Breakthroughs.pdf
How a Staff Augmentation Company IN USA Powers Flutter App Breakthroughs.pdf
mary rojas
 
Top 10 Mobile Banking Apps in the USA.pdf
Top 10 Mobile Banking Apps in the USA.pdfTop 10 Mobile Banking Apps in the USA.pdf
Top 10 Mobile Banking Apps in the USA.pdf
LL Technolab
 
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdfBoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
Ortus Solutions, Corp
 
Oliveira2024 - Combining GPT and Weak Supervision.pdf
Oliveira2024 - Combining GPT and Weak Supervision.pdfOliveira2024 - Combining GPT and Weak Supervision.pdf
Oliveira2024 - Combining GPT and Weak Supervision.pdf
GiliardGodoi1
 
Techdebt handling with cleancode focus and as risk taker
Techdebt handling with cleancode focus and as risk takerTechdebt handling with cleancode focus and as risk taker
Techdebt handling with cleancode focus and as risk taker
RajaNagendraKumar
 
War Story: Removing Offensive Language from Percona Toolkit
War Story: Removing Offensive Language from Percona ToolkitWar Story: Removing Offensive Language from Percona Toolkit
War Story: Removing Offensive Language from Percona Toolkit
Sveta Smirnova
 
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROIAutoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Udit Goenka
 
Feeling Lost in the Blue? Exploring a New Path: AI Mental Health Counselling ...
Feeling Lost in the Blue? Exploring a New Path: AI Mental Health Counselling ...Feeling Lost in the Blue? Exploring a New Path: AI Mental Health Counselling ...
Feeling Lost in the Blue? Exploring a New Path: AI Mental Health Counselling ...
officeiqai
 
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Why Indonesia’s $12.63B Alt-Lending Boom Needs Loan Servicing Automation & Re...
Prachi Desai
 
iOS Developer Resume 2025 | Pramod Kumar
iOS Developer Resume 2025 | Pramod KumariOS Developer Resume 2025 | Pramod Kumar
iOS Developer Resume 2025 | Pramod Kumar
Pramod Kumar
 
zOS CommServer support for the Network Express feature on z17
zOS CommServer support for the Network Express feature on z17zOS CommServer support for the Network Express feature on z17
zOS CommServer support for the Network Express feature on z17
zOSCommserver
 
grade 9 ai project cycle Artificial intelligence.pptx
grade 9 ai project cycle Artificial intelligence.pptxgrade 9 ai project cycle Artificial intelligence.pptx
grade 9 ai project cycle Artificial intelligence.pptx
manikumar465287
 
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfol...
Philip Schwarz
 
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdfSecure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Northwind Technologies
 
Optimising Claims Management with Claims Processing Systems
Optimising Claims Management with Claims Processing SystemsOptimising Claims Management with Claims Processing Systems
Optimising Claims Management with Claims Processing Systems
Insurance Tech Services
 

Data visualization in Python

  • 1. Data Visualization in Python Marc Garcia - @datapythonista Data Visualisation Summit - London, 2017 1 / 34 Data Visualization in Python - @datapythonista
  • 3. Python for data science 3 / 34 Data Visualization in Python - @datapythonista
  • 4. Python for data science Why Python? Python is the favorite of many: Fast to write: Batteries included Easy to read: Readability is KEY Excellent community: Conferences, local groups, stackoverflow... Ubiquitous: Present in all major platforms Easy to integrate: Implements main protocols and formats Easy to extend: C extensions for low-level operations 4 / 34 Data Visualization in Python - @datapythonista
  • 5. Python for data science Python performance Is Python fast for data science? Short answer: No Long answer: Yes numpy Cython C extensions Numba etc. 5 / 34 Data Visualization in Python - @datapythonista
  • 6. Python for data science Python is great for data science A whole ecosystem exists: numpy scipy pandas statsmodels scikit-learn etc. 6 / 34 Data Visualization in Python - @datapythonista
  • 7. Python for data science Python environment One ring to rule them all: 7 / 34 Data Visualization in Python - @datapythonista
  • 8. Python for data science Python platform Jupyter notebook 8 / 34 Data Visualization in Python - @datapythonista
  • 9. Python for data science Python for visualization Main libraries: Matplotlib Seaborn Bokeh HoloViews Datashader Domain-specific Folium: maps yt: volumetric data 9 / 34 Data Visualization in Python - @datapythonista
  • 10. Visualization tools 10 / 34 Data Visualization in Python - @datapythonista
  • 11. Visualization tools Matplotlib First Python visualization tool Still a de-facto standard Replicates Matlab API Supports many backends 11 / 34 Data Visualization in Python - @datapythonista
  • 12. Visualization tools Matplotlib import numpy from matplotlib import pyplot x = numpy.linspace(0., 100., 1001) y = x + numpy.random.randn(1001) * 5 pyplot.plot(x, y) pyplot.xlabel(’time (seconds)’) pyplot.ylabel(’some noisy signal’) pyplot.title(’A simple plot in matplotlib’) 12 / 34 Data Visualization in Python - @datapythonista
  • 13. Visualization tools Matplotlib 13 / 34 Data Visualization in Python - @datapythonista
  • 14. Visualization tools Matplotlib import numpy from matplotlib import pyplot x = numpy.linspace(0., 100., 1001) y1 = x + numpy.random.randn(1001) * 3 y2 = 45 + x * .4 + numpy.random.randn(1001) * 7 pyplot.plot(x, y1, label=’Our previous signal’) pyplot.plot(x, y2, color=’orange’, label=’A new signal’) pyplot.xlabel(’time (seconds)’) pyplot.ylabel(’some noisy signal’) pyplot.title(’A simple plot in matplotlib’) pyplot.legend() 14 / 34 Data Visualization in Python - @datapythonista
  • 15. Visualization tools Matplotlib 15 / 34 Data Visualization in Python - @datapythonista
  • 16. Visualization tools Seaborn Matplotlib wrapper Built-in themes Higher level plots: Heatmap Violin plot Pair plot 16 / 34 Data Visualization in Python - @datapythonista
  • 17. Visualization tools Seaborn from matplotlib import pyplot import seaborn flights_flat = seaborn.load_dataset(’flights’) flights = flights_flat.pivot(’month’, ’year’, ’passengers’) seaborn.heatmap(flights, annot=True, fmt=’d’) pyplot.title(’Number of flight passengers (thousands)’) 17 / 34 Data Visualization in Python - @datapythonista
  • 18. Visualization tools Seaborn 18 / 34 Data Visualization in Python - @datapythonista
  • 19. Visualization tools Bokeh Client-server architecture: JavaScript front-end Interactive Drawing shapes to generate plots 19 / 34 Data Visualization in Python - @datapythonista
  • 20. Visualization tools Bokeh Demo 20 / 34 Data Visualization in Python - @datapythonista
  • 21. Visualization tools HoloViews Bokeh wrapper Higher level plots Mainly for Bokeh, but other backends supported 21 / 34 Data Visualization in Python - @datapythonista
  • 22. Visualization tools HoloViews import numpy as np import holoviews as hv from bokeh.sampledata.us_counties import data as counties from bokeh.sampledata.unemployment import data as unemployment hv.extension(’bokeh’) counties = {code: county for code, county in counties.items() if county[’state’] == ’tx’} county_xs = [county[’lons’] for county in counties.values()] county_ys = [county[’lats’] for county in counties.values()] county_names = [county[’name’] for county in counties.values()] county_rates = [unemployment[county_id] for county_id in counties] county_polys = {name: hv.Polygons((xs, ys), level=rate, vdims=[’Unemployment’]) for name, xs, ys, rate in zip(county_names, county_xs, county_ys, county_rates)} choropleth = hv.NdOverlay(county_polys, kdims=[’County’]) plot_opts = dict(logz=True, tools=[’hover’], xaxis=None, yaxis=None, show_grid=False, show_frame=False, width=500, height=500) style = dict(line_color=’white’) choropleth({’Polygons’: {’style’: style, ’plot’: plot_opts}}) 22 / 34 Data Visualization in Python - @datapythonista
  • 23. Visualization tools HoloViews 23 / 34 Data Visualization in Python - @datapythonista
  • 24. Visualization tools Datashader Bokeh wrapper Built for big data Advanced subsampling and binning techniques 24 / 34 Data Visualization in Python - @datapythonista
  • 25. Visualization tools Datashader 25 / 34 Data Visualization in Python - @datapythonista
  • 26. Visualization tools Folium Visualization of maps Compatible with Google maps and Open street maps Visualization of markers, paths and polygons 26 / 34 Data Visualization in Python - @datapythonista
  • 27. Visualization tools Folium import folium m = folium.Map(location=[45.372, -121.6972], zoom_start=12, tiles=’Stamen Terrain’) folium.Marker(location=[45.3288, -121.6625], popup=’Mt. Hood Meadows’, icon=folium.Icon(icon=’cloud’)).add_to(m) folium.Marker(location=[45.3311, -121.7113], popup=’Timberline Lodge’, icon=folium.Icon(color=’green’)).add_to(m) folium.Marker(location=[45.3300, -121.6823], popup=’Some Other Location’, icon=folium.Icon(color=’red’, icon=’info-sign’)).add_to(m) m 27 / 34 Data Visualization in Python - @datapythonista
  • 28. Visualization tools Folium 28 / 34 Data Visualization in Python - @datapythonista
  • 29. Visualization tools yt Visualization of volumetric data Compatible with many formats Projects multidimensional data to a 2-D plane 29 / 34 Data Visualization in Python - @datapythonista
  • 30. Visualization tools yt import yt ds = yt.load(’MOOSE_sample_data/out.e-s010’) sc = yt.create_scene(ds) ms = sc.get_source() ms.cmap = ’Eos A’ cam = sc.camera cam.focus = ds.arr([0.0, 0.0, 0.0], ’code_length’) cam_pos = ds.arr([-3.0, 3.0, -3.0], ’code_length’) north_vector = ds.arr([0.0, -1.0, -1.0], ’dimensionless’) cam.set_position(cam_pos, north_vector) cam.resolution = (800, 800) sc.save() 30 / 34 Data Visualization in Python - @datapythonista
  • 31. Visualization tools yt 31 / 34 Data Visualization in Python - @datapythonista
  • 32. Conclusions 32 / 34 Data Visualization in Python - @datapythonista
  • 33. Conclusions Conclusions Python is great as a programming language And is great for data science Plenty of options for visualization: Standard plots Ad-hoc plots Interactive 3D plots Maps Big data Specialized 33 / 34 Data Visualization in Python - @datapythonista
  • 34. Conclusions Questions? @datapythonista 34 / 34 Data Visualization in Python - @datapythonista