Notes on pyplot Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction.

Slides:



Advertisements
Similar presentations
Plotting Selim Aksoy Bilkent University Department of Computer Engineering
Advertisements

Introduction to Graphing Using MATLAB. Line Graphs  Useful for graphing functions  Useful for displaying data trends over time  Useful for showing.
1 Introduction to Computer Graphics with WebGL Prof. John Gauch CSCE Department Spring 2015 Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley.
Scatter Plots with Your calculator Section 4-6. Page 636#10.
Chapter 9 Section 5 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
MATLAB - Lecture 22A Two Dimensional Plots / Chapter 5 Topics Covered:
Introduction We have worked with linear equations and equations of circles. We have solved systems of equations, including systems involving linear equations.
PYTHON PLOTTING CURVES CHAPTER 10_5 FROM THINK PYTHON HOW TO THINK LIKE A COMPUTER SCIENTIST.
Setting Up Clear any equations or lists from your calculator to start! Clear any equations or lists from your calculator to start! ~From the Y= list ~From.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
ENG College of Engineering Engineering Education Innovation Center 1 2D Plots 1 in MATLAB Topics Covered: 1.Plotting basic 2-D plots The plot()
418512: Computer Programming Languages Lecture 7 Pramook Khungurn TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A AAAA.
Visualization UW CSE 140 Winter matplotlib Strives to emulate MATLAB – Pro: familiar to MATLAB users – Pro: powerful – Con: not the best design.
Chapter 4 Applications of Quadratic Models. To graph the quadratic equation y = ax 2 + bx +c  Use vertex formula x v = -b/2a  Find the y-coordinate.
Graphing Quadratic Equations Standard Form & Vertex Form.
Introduction to Programming Workshop 6 PHYS1101 Discovery Skills in Physics Dr. Nigel Dipper Room 125d
T-4 Entering Data, Setting a Window, and Histograms Calculator Steps and Instructions.
ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB – 2D Plots 1 Go to the class drive: ---> MatLab - Graphing ---> Seed Files.
Unit 1: Function Families Lesson 5: Transformations & Symmetry Notes Graph y = ax 2 + bx + c.
13-5 The cosine Function Today’s Objective: I can graph the cosine function.
Plot (x-values, y-values) >> x = linspace (-3, 3, 20); >> x = linspace (-3, 3, 20); >> y = 2*x – 1; >> y = 2*x – 1; >> plot (x, y) >> plot (x, y)
Section 2-5 Continued Scatter Plots And Correlation.
Linear Models YearPopulation (millions) Create a scatterplot of the population for North Carolina.
Functions and Models 1. Graphing Calculators and Computers 1.4.
Chapter 4.1: Scatter Plots. Lesson 4.1: Scatter Plots.
13-4 The Sine Function Today’s Objective: I can graph the sine function.
9.1 – Graphing Quadratic Functions. Ex. 1 Use a table of values to graph the following functions. a. y = 2x 2 – 4x – 5.
Ch : Which Values Are Possible? Domain & Range.
Introduction to Engineering MATLAB – 9 Plotting - 2 Agenda Formatting plots.
Trigonometric Functions: The Unit Circle Section 4.2.
Objective – Students will be able to investigate graphs with different viewing windows or viewing screens. Therefore learning how important it is to choose.
Chapter 4: Polynomials Quadratic Functions (Section 4.1)
What do these situations have in common? Explain..
7.1 – Cartesian Co-ordinate System & Linear Equations in Two Variables
Today we will graph linear equations in slope intercept form.
IPYTHON AND MATPLOTLIB Python for computational science
Two-Dimensional Plots
Bringing up a child in the 21st century
Visualization UW CSE 160 Spring 2018.
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Visualization UW CSE 160 Winter 2016.
Python plotting curves chapter 10_5
Visualization UW CSE 160 Winter 2017.
Plotting Multiple Graphs In The Same Plot
Matplotlib.
Decision Structures and Indefinite Loops
Introduction to Dictionaries
Homework #5 — Monte Carlo Simulation
Elements of a Python Program
More About Functions Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Variables, Lists, and Objects
Debuggers and Debugging
Simple Graphics Package
Objects (again) Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction.
More elements of Python programs
Notes about Homework #4 Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming:
CSV files Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction.
Plotting Signals in MATLAB
Note on Program Design Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming:
Notes on Homework #6 Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Quadratic Functions in the Form y = a(x – h)2 + k
Bringing up a child in the 21st century
Window to Viewport Transformations
Visualization UW CSE 160 Spring 2015.
The Real Zeros of a Polynomial Function
The Real Zeros of a Polynomial Function
Numpy, pylab, matplotlib (follow-up)
Shapes.
Matplotlib and Pandas
Programming with data Lab 3
Presentation transcript:

Notes on pyplot Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction to Computer Science, 2nd edition, by John Zelle and copyright notes by Prof. George Heineman of Worcester Polytechnic Institute) CS-1004, A-Term 2014 Notes on pyplot

pyplot Collection of functions that make matplotlib work (somewhat) like MATLAB Getting started:– import matplotlib.pyplot as plt someList = [1, 1/2, 1/3, 1/4, 1/5, 1/6] plt.plot(someList) plt.show() “as” clause is optional Allows shorthand naming! Brings up a graph window plot adds it own x-axis CS-1004, A-Term 2014 Notes on pyplot

pyplot (continued) Plotting with x- and y-axes yValues = [1, 1/2, 1/3, 1/4, 1/5, 1/6] xValues = [1, 2, 3, 4, 5, 6] plt.plot(xValues, yValues) plt.show() plt.plot(xValues, yValues, 'bo') 3rd argument values indicate format of points, etc. 'bo' — blue circles 'g^' — green triangles … y-axis list is 2nd argument x-axis list is 1st argument Optional 3rd argument CS-1004, A-Term 2014 Notes on pyplot

Multiple plots Plotting with several sets of x- and y-axes y1Values = [1, 1/2, 1/3, 1/4, 1/5, 1/6] y2Values = [1, 2*2, 3*3, 4*4, 5*5, 6*6] xValues = [1, 2, 3, 4, 5, 6] plt.plot(xValues, y1Values, xValues, y2Values) plt.show() plt.plot(xValues, y1Values, 'bo', xValues, y2Values, 'r^') plt.show() CS-1004, A-Term 2014 Notes on pyplot

Other pyplot functions plt.ylabel('some text') plt.xlabel('some other text') plt.axis([xMin, xMax, yMin, yMax]) Many, many options and controls More than can be covered in this course More than you will need in near future Substitute values for min and max of axes CS-1004, A-Term 2014 Notes on pyplot

Questions? CS-1004, A-Term 2014 Notes on pyplot