data visualization in matplotlib

Post on 15-Jul-2015

194 Views

Category:

Data & Analytics

5 Downloads

Preview:

Click to see full reader

TRANSCRIPT

LET YOUR DATA SPEAK!DATA VISUALISATION IN MATPLOTLIB

by Bartosz Teleńczuk

INTR

ODUC

TION

ANSCOMBE DATASET

EXPLORATORY DATA ANALYSISThe greatest value of a picture is when it forces

us to notice what we never expected to see.

VISUAL PRESENTATION

2004 2005 2006 2007 2008 2009 2010 2011 2012 2013

The Journal of neuroscience :...Nature neurosciencePloS oneNatureNeuronProceedings of the National...Nature methodsCurrent opinion in...Science (New York, N.Y.)Current biology : CBJournal of neurophysiologyFrontiers in neural circuitsBrain researchFrontiers in molecular...The Journal of biological...Conference proceedings : ......Progress in brain researchJournal of neuroscience...Journal of visualized...Neuroscience researchCellBiological psychiatryThe Journal of physiologyNature protocolsBehavioural brain researchExperimental physiologyNeuropharmacologyNeuroscienceNature communicationsNeurosurgery

INTERACTIVE

PRESENTATION

John Hunter (1968 - 2012)

PATTERNS OVER TIME

BACKENDSTkAgg Qt4Agg WebAgg

ANTIGRAIN GEOMETRY

Raster (PNG) Vector (SVG)

PYPLOT INTERFACE import matplotlib.pyplot as pltplt.figure()plt.subplot(...)plt.plot(...) plt.show()

pyplot is a stateful interface that handles muchof the boilerplate for creating figures and axesand connecting them to the backend of your

choice, and maintains module-level internal datastructures representing the current figure and

axes to which to direct plotting commands.

RECAPplt.plotplt.showplt.xlabelplt.ylabelplt.xlimplt.gcaplt.text

xaxis.set_minor_locatoryaxis.set_major_locator

YearsLocatorMonthLocator

PROPORTIONS

ARTISTS

Figure Axes

Line2D

X/YAxis

Spines

Label

Ticks

DESIGN POINTS

SIGNAL-TO-NOISE RATIO

RECAPplt.bar

plt.xticks(pos, labels) Spine.set_visible

Axis.set_ticks_position Axes.set_axis_bgcolor

plt.grid plt.title

DISTRIBUTIONS

STEM-AND-LEAF PLOT1.1 2.2 2.8 3.2 3.4 3.4 3.5 4.1 4.9 5.5 5.7

1. 12. 2 83. 2 4 4 54. 1 95. 5 7

BOXPLOTS

TRANSFORMS

data transform

axes transform

(7,1)

(7,-1)(0,-1)

(0,1)

(1,0)

(1,1)(0,1)

(0,0)

figure transform (1,1)(0,1)

(0,0) (1,0)

RECAPplt.histplt.boxplotplt.legendplt.textplt.setpplt.vlines

Axes.transAxesAxes.transData

blended_transform_factory

CORRELATIONS

SMALL MULTIPLIES

USE OF COLOR

*

*

jet

hot

gray

heatmap

Bang Wong, Nature Methods, 2010

VISUAL ILLUSION

MATPLOTLIB COLORMAPS

RECAPplt.subplots

Axes.set_axis_offplt.imshowrcParams

FINDING PATTERNS

PRINCIPAL COMPONENT ANALYSIS

K-MEANS CLUSTERING

VISUAL ENCODING CHANNELSposition

color saturation

length

angle

area

volume

color intensity

shape

color hue

RECAPplt.scatter

mcolors.Normalizecm.get_cmap

MAKING MAPS

MAP PROJECTIONS

CHOROPLETH MAP

RECAPmatplotlib plt.contourf cartopy

cartopy.crscartopy.ioax.coastlinesax.add_featureax.set_extentax.add_image

ax.add_geometries

top related