CIS192 Python Programming

Similar documents
PASS Sample Size Software. These options specify the characteristics of the lines, labels, and tick marks along the X and Y axes.

PASS Sample Size Software

Step 1: Set up the variables AB Design. Use the top cells to label the variables that will be displayed on the X and Y axes of the graph

Plots Publication Format Figures Multiple. 2D Plots. K. Cooper 1. 1 Department of Mathematics. Washington State University.

MATHEMATICAL FUNCTIONS AND GRAPHS

Graphing with Excel. Data Table

Excel Tool: Plots of Data Sets

Sections Descriptive Statistics for Numerical Variables

IPython and Matplotlib

Creating Nice 2D-Diagrams

Purpose. Charts and graphs. create a visual representation of the data. make the spreadsheet information easier to understand.

Introduction to Matplotlib

Topics for today. Why not use R for graphics? Why use R for graphics? Introduction to R Graphics: U i R t t fi. Using R to create figures

Excel Lab 2: Plots of Data Sets

Section 3 Correlation and Regression - Worksheet

BE540 - Introduction to Biostatistics Computer Illustration. Topic 1 Summarizing Data Software: STATA. A Visit to Yellowstone National Park, USA

4 Exploration. 4.1 Data exploration using R tools

Plotting. Aaron S. Donahue. Department of Civil and Environmental Engineering and Earth Sciences University of Notre Dame January 28, 2013 CE20140

SS Understand charts and graphs used in business.

CSCD 409 Scientific Programming. Module 6: Plotting (Chpt 5)

Why Should We Care? Everyone uses plotting But most people ignore or are unaware of simple principles Default plotting tools are not always the best

A To draw a line graph showing the connection between the time and cost

Excel Manual X Axis Scale Start At Graph

Comparing Across Categories Part of a Series of Tutorials on using Google Sheets to work with data for making charts in Venngage

Appendix 3 - Using A Spreadsheet for Data Analysis

Math 259 Winter Recitation Handout 6: Limits in Two Dimensions

NCSS Statistical Software

Plotting scientific data in MS Excel 2003/2004

Write a spreadsheet formula in cell A3 to calculate the next value of h. Formulae

Problem 1 Multiple sets of data on a single graph [Gottfried, pg. 92], Downloading, Importing Data

Contents. An introduction to MATLAB for new and advanced users

Excel 2003: Discos. 1. Open Excel. 2. Create Choose a new worksheet and save the file to your area calling it: Disco.xls

15-388/688 - Practical Data Science: Visualization and Data Exploration. J. Zico Kolter Carnegie Mellon University Spring 2018

CHM 152 Lab 1: Plotting with Excel updated: May 2011

Sensors and Scatterplots Activity Excel Worksheet

Assignment 5 due Monday, May 7

How to Make a Run Chart in Excel

Appendix C: Graphing. How do I plot data and uncertainties? Another technique that makes data analysis easier is to record all your data in a table.

jimfusion Satellite image manipulation SOFTWARE FEATURES QUICK GUIDE

hp calculators HP 50g Working with Polar Plots Plotting on the HP 50g The 2D/3D (PLOT SETUP) Form The Y= Form The WIN Form Examples of polar plots

Excel Manual X Axis Label Below Chart 2010 >>>CLICK HERE<<<

Spreadsheets 3: Charts and Graphs

This tutorial will lead you through step-by-step to make the plot below using Excel.

Learning Some Simple Plotting Features of R 15

Laboratory 2: Graphing

Computer Programming ECIV 2303 Chapter 5 Two-Dimensional Plots Instructor: Dr. Talal Skaik Islamic University of Gaza Faculty of Engineering

Why Should We Care? More importantly, it is easy to lie or deceive people with bad plots

AECOsim Building Designer. Quick Start Guide. Chapter A08 Space Planning Bentley Systems, Incorporated

ECE 585 Microwave Engineering II Lecture 16 Supplemental Notes. Modeling the Response of a FET Amplifier Using Ansoft Designer K.

3/7/2015. Wind Data. Finding Historical Wind Data. Finding Historical Wind Data. Finding Historical Wind Data. Wind Power Management

Introduction to Pandas and Time Series Analysis

Describing Data Visually. Describing Data Visually. Describing Data Visually 9/28/12. Applied Statistics in Business & Economics, 4 th edition

CHM 109 Excel Refresher Exercise adapted from Dr. C. Bender s exercise

1.1 Displaying Distributions with Graphs, Continued

Descriptive Statistics II. Graphical summary of the distribution of a numerical variable. Boxplot

CREATING (AB) SINGLE- SUBJECT DESIGN GRAPHS IN MICROSOFT EXCEL Lets try to graph this data

Section 1.5 Graphs and Describing Distributions

Office 2016 Excel Basics 24 Video/Class Project #36 Excel Basics 24: Visualize Quantitative Data with Excel Charts. No Chart Junk!!!

Chapter 10. Definition: Categorical Variables. Graphs, Good and Bad. Distribution

Class #16: Experiment Matlab and Data Analysis

Elementary Plotting Techniques

EKA Laboratory Muon Lifetime Experiment Instructions. October 2006

An Introduction to Data Visualization with RStudio November 29, 2018

Outline. 1 File access. 2 Plotting Data. 3 Annotating Plots. 4 Many Data - one Figure. 5 Saving your Figure. 6 Misc. 7 Examples

How to define Graph in HDSME

Page 21 GRAPHING OBJECTIVES:

Introduction to Pandas and Time Series Analysis. Alexander C. S.

Algebra. Teacher s Guide

Graphs. This tutorial will cover the curves of graphs that you are likely to encounter in physics and chemistry.

1. Start with scatter plot: 2. Find corner points. 3. Capture image. 4. Corners

Two-dimensional Plots

Notes 5C: Statistical Tables and Graphs

Ansoft Designer Tutorial ECE 584 October, 2004

Elementary Statistics. Graphing Data

Chapter 2. The Excel functions, Excel Analysis ToolPak Add-ins or Excel PHStat2 Add-ins needed to create frequency distributions are:

Mastering AutoCAD 2D

Getting Started with Algebra 2. Perimeter and Area Models ID: 9837

Lab 3: Very Brief Introduction to Micro-Cap SPICE

Assignment 4: Permutations and Combinations

Excel Manual X Axis Values Chart Multiple Labels Negative

New Mexico Pan Evaporation CE 547 Assignment 2 Writeup Tom Heller

Preparation of figures for Publication in Clinical and Experimental Pharmacology and Physiology

Advance Steel suite 6.1 / SP2

EXERCISE 1: CREATE LINE SPARKLINES

Graphs and Charts: Creating the Football Field Valuation Graph

Excel Manual X Axis Label Not Showing

Unit 5: Graphs. Input. Output. Cartesian Coordinate System. Ordered Pair

Creating Run Charts (Time Series Plots, Line Charts) Excel 2010 Tutorial

1. What are the coordinates for the viewer s eye?

Package plotpc. September 27, Index 10. Plot principal component loadings

Inventor Modeling Procedure By: Eric Small January 18, 2011

Microsoft Excel. Creating a Pie Chart on a Picture. 1. In order to create a pie chart on a picture, you need to first find

The source component is the AC_POWER source, not AC_VOLTAGE as we ve used in previous Demos. It can be accessed under:

GIS Module GMS 7.0 TUTORIALS. 1 Introduction. 1.1 Contents

Jeff Smith s Individual, Pairs & Teams programs

OOo Switch: 501 Things You Wanted to Know About Switching to OpenOffice.org from Microsoft Office

Midterm is on Thursday!

v. 8.0 GMS 8.0 Tutorial GIS Module Shapefile import, display, and conversion Prerequisite Tutorials None Time minutes

Q Scheme Marks AOs. 1a All points correctly plotted. B2 1.1b 2nd Draw and interpret scatter diagrams for bivariate data.

BG-Map Mapping the world one plant at a time

Transcription:

CIS192 Python Programming Data Visualization Harry Smith University of Pennsylvania April 13, 2016 Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 1 / 18

Outline 1 Introduction and Motivation 2 Getting Started 3 3D 4 Flight Work and Other Interesting Concepts Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 2 / 18

Motivation The first step in using data is understanding it. Numbers are complicated and ugly. Colors are pretty. Properly visualized data is effective communication on its own. A scientific paper with well-crafted figures is much more effective than one with dreaded "Data Appendices" Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 3 / 18

Consider something like this... Figure: Lookin good. Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 4 / 18

...over its original form. Figure: YIKES Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 5 / 18

Outline 1 Introduction and Motivation 2 Getting Started 3 3D 4 Flight Work and Other Interesting Concepts Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 6 / 18

Data Comes in Many Forms CSV Use native csv library from Python Simple, robust Stands for Comma Separated Values Can also read Tab-Delimited Files Excel Spreadsheets Install with: pip install xlrd Plays nicely with the Excel models of Books, Sheets, and Cells Fixed Width Data Files Use native struct library from Python Similar to CSVs but lacking a specific data separator. Implemented in C rather than Python (Cython): very fast! JSON Use native requests library from Python Get data straight from the web. Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 7 / 18

Matplotlib and Outputting the Figures Simple types of plots to plot 1 plot() is a marked scatter plot with the individual data points unenumerated by default. 2 bar() is a bar plot. 3 hist() is a histogram bar plot. 4 hbar() is a horizontal bar plot. 5 boxplot() is a box and whisker plot. 6 scatter() is a scatter plot with line markings turned off by default. Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 8 / 18

Matplotlib and Formatting the Figures Methods of changing the appearance of a plot 1 subplot(int x) allows you to choose a section of a figure that you want to plot on. For example, subplot(311) means that you have a 3-row 1-column plot and you will plot in the 1st (top) section. 2 title() gives the graph a title. 3 xlim(), ylim() allow for the setting of the ranges of the axes. 4 xticks(), yticks() allow for the placement of tick marks and labels on the graph s axes. 5 legend() generates a legend for your graph. You can specify names for the plotted figures in plotting order or use labels passed in at the time of plotting. 6 annotate() allows for the highlighting of a specific value or region. Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 9 / 18

Unlocking Your Full Matplotlib Potential This goes much deeper than the above. Visit matplotlib.org to check out all optional parameters for each of the above functions. color and colormaps thickness background coloring location on plot formatting modes Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 10 / 18

Pre-processing and Useful Tricks Removing outliers If you know what behavior your data should follow, you can remove outliers to make the picture better. Smoothing Sometimes in data presentation, it s better to show the big idea rather than all the minute details. Can use median filters (matplotlib.signal.medfilt()) or averaging boxes (convolve()). Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 11 / 18

Be Honest! Don t misrepresent your data! Use the previous tricks to clarify rather than obfuscate. Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 12 / 18

Outline 1 Introduction and Motivation 2 Getting Started 3 3D 4 Flight Work and Other Interesting Concepts Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 13 / 18

3D Plotting Use mpl_toolkits.mplot3d, which features the following classes: 1 axes3d is a 3D plotting library that works very similar to typical matplotlib 2D plotting 2 axis3d is an outdated 3D plotting library that apparently suffers from being buggy and poorly designed. Avoid! 3 art3d is a 3D art class which is used to build components of axes3d, but has some interesting features of its own right. 4 proj3d is the background class for these others. When plotting in 3D, you must always be careful to specify your dimensions. Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 14 / 18

Functions to produce 3D plots 1 Axes3D.plot() gives a marked scatter 2 Axes3D.scatter() gives an unmarked scatter plot 3 Axes3D.plot_wireframe() plots a transparent mesh of a surface. 4 Axes3D.plot_surface() plots a solid surface 5 Axes3D.plot_trisurf() plots a solid surface made from a Triangulation object 6 Axes3D.contour() plots a 3D contour 7 Others, like quivers, 2D plots, bar plots, polygon plots. Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 15 / 18

Outline 1 Introduction and Motivation 2 Getting Started 3 3D 4 Flight Work and Other Interesting Concepts Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 16 / 18

Expanding your visualization vocabulary There are many other projects and implementations that you can consider incorporating into your data visualization scikits.audiolab allows you to analyze sound files and plot their frequencies. pip install scikits.audiolab If you re feeling confident with your HTML and JSON vocabulary, you can look into Google Visualization API for plotting to the web Basemap is a library that makes coordinate generation easy. It s great if you re looking to plot with respect to space. PIL and Images (as you might remember) are excellent libraries for reading in images and using them as data. Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 17 / 18

Looking on to Airline Delays Now we can take a page out of FiveThirtyEight s book. We can download some airline delay data from http://www.transtats.bts.gov/ and play around Harry Smith (University of Pennsylvania) CIS 192 April 13, 2016 18 / 18