Day 2: Introduction to Visualizations matplotlib 1 Visualization != Sexy Pictures 2 The Basics blog.okcupid.com 3 Bar Graph © Humor Rainbow, Inc. All rights reserved. This content is excluded from our Creative Commons license. For more information, see http://ocw.mit.edu/fairuse. 4 http://blog.okcupid.com Scatter Plot © Humor Rainbow, Inc. All rights reserved. This content is excluded from our Creative Commons license. For more information, see http://ocw.mit.edu/fairuse. 5 http://blog.okcupid.com Line Graph © Humor Rainbow, Inc. All rights reserved. This content is excluded from our Creative Commons license. For more information, see http://ocw.mit.edu/fairuse. 6 http://blog.okcupid.com Choropleth Plots © Humor Rainbow, Inc. All rights reserved. This content is excluded from our Creative Commons license. For more information, see http://ocw.mit.edu/fairuse. 7 http://blog.okcupid.com Box Plots 8 matplotlib Python’s version of Matlab plotting 9 How matplotlib Draws 10 Figure object Figure 11 Subplot object Subplot Draw in here Draw in here Figure 12 figure.add_subplot(2, 3, 1) 2 rows 3 columns 13 figure.add_subplot(2, 3, 1) 2 rows 3 columns 14 figure.add_subplot(2, 3, 1) 2 rows 3 columns 15 figure.add_subplot(2, 3, 1) 1 2 rows 3 columns 16 Charting Library • • • • subplot.bar() subplot.plot() subplot.scatter() subplot.boxplot() 17 Lines Subplot Figure 18 Boxes Subplot Figure 19 Polygons Subplot Figure 20 Overlaps Subplot Figure 21 Overlaps Subplot Figure 22 Choropleth Plots © Humor Rainbow, Inc. All rights reserved. This content is excluded from our Creative Commons license. For more information, see http://ocw.mit.edu/fairuse. 23 http://blog.okcupid.com No Easy Way 24 How Maps are Drawn 25 How Maps are Drawn 26 Helper Functions FIPS draw_county(subplot, county_id, color) draw_state(subplot, state, color) 27 MIT OpenCourseWare http://ocw.mit.edu Resource: How to Process, Analyze and Visualize Data Adam Marcus and Eugene Wu The following may not correspond to a particular course on MIT OpenCourseWare, but has been provided by the author as an individual learning resource. For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.