LESSON QUESTIONS: Bar charts



Similar documents
ABOUT THIS DOCUMENT ABOUT CHARTS/COMMON TERMINOLOGY

The Center for Teaching, Learning, & Technology

Formulas, Functions and Charts

Examples of Data Representation using Tables, Graphs and Charts

ITS Training Class Charts and PivotTables Using Excel 2007

Create Charts in Excel

Introduction to Microsoft Excel 2007/2010

Scatter Plots with Error Bars

Lab 11: Budgeting with Excel

Excel 2007 Basic knowledge

Intermediate PowerPoint

APES Math Review. For each problem show every step of your work, and indicate the cancellation of all units No Calculators!!

Dealing with Data in Excel 2010

Excel Using Pivot Tables

Acquisition Lesson Planning Form Key Standards addressed in this Lesson: MM2A3d,e Time allotted for this Lesson: 4 Hours

Excel Using Pivot Tables

Linear Algebra and TI 89

Creating Bar Charts and Pie Charts Excel 2010 Tutorial (small revisions 1/20/14)

with functions, expressions and equations which follow in units 3 and 4.

This file contains 2 years of our interlibrary loan transactions downloaded from ILLiad. 70,000+ rows, multiple fields = an ideal file for pivot

Simplifying Logic Circuits with Karnaugh Maps

How to make a line graph using Excel 2007

Using SPSS, Chapter 2: Descriptive Statistics

Creating an Excel XY (Scatter) Plot

Using Casio Graphics Calculators

Microsoft Excel 2010 Charts and Graphs

This activity will show you how to draw graphs of algebraic functions in Excel.

Curve Fitting, Loglog Plots, and Semilog Plots 1

Gestation Period as a function of Lifespan

Quantitative vs. Categorical Data: A Difference Worth Knowing Stephen Few April 2005

Graphing Quadratic Functions

Creating a Poster Presentation using PowerPoint

Scientific Graphing in Excel 2010

Microsoft Excel 2010 Part 3: Advanced Excel

Valor Christian High School Mrs. Bogar Biology Graphing Fun with a Paper Towel Lab

Drawing a histogram using Excel

Excel -- Creating Charts

About PivotTable reports

Sample Table. Columns. Column 1 Column 2 Column 3 Row 1 Cell 1 Cell 2 Cell 3 Row 2 Cell 4 Cell 5 Cell 6 Row 3 Cell 7 Cell 8 Cell 9.

Dr. Lisa White

There are six different windows that can be opened when using SPSS. The following will give a description of each of them.

"Excel with Excel 2013: Pivoting with Pivot Tables" by Venu Gopalakrishna Remani. October 28, 2014

PLOTTING DATA AND INTERPRETING GRAPHS

Math Journal HMH Mega Math. itools Number

Excel & Visual Basic for Applications (VBA)

Tutorial 3: Graphics and Exploratory Data Analysis in R Jason Pienaar and Tom Miller

Coins, Presidents, and Justices: Normal Distributions and z-scores

Computational Mathematics with Python

Excel 2007 A Beginners Guide

The Pointless Machine and Escape of the Clones

Statistics Revision Sheet Question 6 of Paper 2

Infographics in the Classroom: Using Data Visualization to Engage in Scientific Practices

Determination of g using a spring

Glencoe. correlated to SOUTH CAROLINA MATH CURRICULUM STANDARDS GRADE 6 3-3, , , 4-9

Pennsylvania System of School Assessment

Lecture 2 Mathcad Basics

Consolidation of Grade 3 EQAO Questions Data Management & Probability

ISA HELP BOOKLET AQA SCIENCE NAME: Class:

Microsoft Excel 2010 Tutorial

Advanced Microsoft Excel 2010

A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form

Information Literacy Program

Linear Equations. Find the domain and the range of the following set. {(4,5), (7,8), (-1,3), (3,3), (2,-3)}

Polynomial and Rational Functions

Describing, Exploring, and Comparing Data

CHARTS AND GRAPHS INTRODUCTION USING SPSS TO DRAW GRAPHS SPSS GRAPH OPTIONS CAG08

Lab: Graphing Activities TOTTEN

The following is an overview of lessons included in the tutorial.

Chapter 32 Histograms and Bar Charts. Chapter Table of Contents VARIABLES METHOD OUTPUT REFERENCES...474

MATLAB Functions. function [Out_1,Out_2,,Out_N] = function_name(in_1,in_2,,in_m)

Beginner s Matlab Tutorial

Factorizations: Searching for Factor Strings

Direct and Reflected: Understanding the Truth with Y-S 3

Performing Simple Calculations Using the Status Bar

Computational Mathematics with Python

Assignment objectives:

Session 7 Bivariate Data and Analysis

Three daily lessons. Year 5

Excel Math Project for 8th Grade Identifying Patterns

Intro to Excel spreadsheets

Mathematical goals. Starting points. Materials required. Time needed

TEACHER NOTES MATH NSPIRED

9.4. The Scalar Product. Introduction. Prerequisites. Learning Style. Learning Outcomes

Functional Skills Mathematics Level 2 sample assessment

GeoGebra. 10 lessons. Gerrit Stols

Computational Mathematics with Python

Analysis of System Performance IN2072 Chapter M Matlab Tutorial

Excel 2003 A Beginners Guide

Engineering Problem Solving and Excel. EGN 1006 Introduction to Engineering

Unit 9 Describing Relationships in Scatter Plots and Line Graphs

To Evaluate an Algebraic Expression

Florida Math for College Readiness

Chapter 2: Frequency Distributions and Graphs

Plotting: Customizing the Graph

Ready, Set, Go! Math Games for Serious Minds

One-Way ANOVA using SPSS SPSS ANOVA procedures found in the Compare Means analyses. Specifically, we demonstrate

Excel Level Two. Introduction. Contents. Exploring Formulas. Entering Formulas

Creating Charts in Microsoft Excel A supplement to Chapter 5 of Quantitative Approaches in Business Studies

How do you compare numbers? On a number line, larger numbers are to the right and smaller numbers are to the left.

Transcription:

LESSON QUESTIONS: Bar charts FOCUS QUESTION: How can I show proportions and relative sizes of different data groups? Contents EXAMPLE 1: Load the data about New York contagious diseases EXAMPLE 2: Calculate individual and overall monthly totals (combining columns) EXAMPLE 3: Create a bar chart of the measles monthly case totals (bar(y)) EXAMPLE 4: Label the bars explicitly (set(gca,...)) EXAMPLE 5: Create a bar chart of the measles yearly case totals (bar(x,y)) EXAMPLE 6: Create a side by side bar chart of monthly totals EXAMPLE 7: Create a stacked bar chart of monthly totals EXAMPLE 8: Create horizontal stacked bar chart using a different color scheme (colormap) EXAMPLE 1: Load the data about New York contagious diseases load NYCDiseases.mat; EXAMPLE 2: Calculate individual and overall monthly totals (combining columns) measlesbymonth = sum(measles, 1); mumpsbymonth = sum(mumps, 1); CPByMonth = sum(chickenpox, 1); bymonth = [measlesbymonth', mumpsbymonth', CPByMonth']; Questions What is the size of sum(measles)? What does [a, b, c] mean? What does the prime (') mean? What is the size of measlesbymonth'? Why does bymonth have 12 rows and 3 columns? Why was the transpose operator necessary? Since measles is an array with 41 rows and 12 columns, the result of sum(measles) is an array with 1 row of 12 columns. (Remember that sum without a second argument calculates the sums of the individual columns for 2D arrays.) The square brackets ([]) indicate a new array formed by placing the arrays a, b, and c side by side. The prime (') means to take the transpose of the array. The transpose operator flips the array along the main diagonal to produce a new array. (The rows of the original array are the columns of the transposed array.) Since measlesbymonth is a single row with 12 columns, the size of measlesbymonth' is 1 column of 12 rows (i.e., 1 x 12). MATLAB forms the array by placing side by side three arrays, each consisting of a single column of 12 rows. Without the transpose operator, the row vectors measlesbymonth, mumpsbymonth and CPByMonth would be placed side by side to form a single row vector of 36 elements. Plotting bymonth using a bar graph results in the 12 bars of the measles monthly totals, followed by the 12 bars of the mumps monthly totals, and ending with 12 bars of the chicken pox monthly totals. In order to have a bar graph where the bars representing January for the three diseases are

grouped together, the array must have the January values as the first row. EXAMPLE 3: Create a bar chart of the measles monthly case totals (bar(y)) bar(measlesbymonth./1000) xlabel('month') title('measles by month in NYC: 1931 1971') Questions How many bars does this graph have? Why rescale the data using units of thousands of cases rather than just cases? The graph has 12 bars, representing the 12 months. Tick mark labels of large magnitude are difficult to read and comprehend. MATLAB tries to alleviate this problem by presenting the tick mark labels in scientific notation with the exponent displayed above the axis. However, the exponent is easy to miss. The axis rescaling makes the graph easier for most viewers to understand. EXAMPLE 4: Label the bars explicitly (set(gca,...)) mylabels = {'J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'}; bar(measlesbymonth./1000)

xlabel('month') title('measles by month in NYC: 1931 1971'); set(gca,'xticklabelmode', 'manual',... 'XTickLabel', mylabels) Questions What is gca? Why do I need to set the mode for the x axis tick labels to be manual? What tick labels does MATALB automatically choose for bar graphs? Why are the tick mark labels enclosed with single quotes? Why was the list of tick mark labels enclosed with curly braces rather than square brackets? The gca identifier is a reference or handle to the current axes. Use gca to get or set graphical properties of the current axes in the current. You can save this handle in a variable and refer to this axes later, when you have created other axes and this axes is not the current one. The 'manual' setting of the 'XTickLabelMode' property specifies that MATLAB should not try to automatically set the tick mark labels. Instead, MATLAB should use the labels that you have given using the 'XTickLabel' property of the current axis. MATLAB uses the bar positions 1, 2,... if you don't specify your own tick mark labels. The enclosing single quotes specify that the labels are strings (i.e., messages not a variables). Use square brackets ([ ]) to create an ordinary array, which must have elements of the same size and type. Use curly braces ({ }) to create a cell array, which may have elements of different sizes and types. In this example the array elements are string, which usually differ in length.

EXAMPLE 5: Create a bar chart of the measles yearly case totals (bar(x,y)) bar(years, sum(measles, 2)./1000) xlabel('year') title('measles by year in NYC: 1931 1971') EXAMPLE 6: Create a side by side bar chart of monthly totals bar(bymonth./1000) xlabel('month') title('childhood diseases by month in NYC: 1931 1971') legend('measles', 'Mumps', 'Chicken pox')

Questions What does each bar in this graph represent? How are the bars grouped? What is the order of the bars within each group? An individual bar represents the total number of cases for a particular disease in a particular month. MATLAB groups by row number. That is, all of the bars for the first row are displayed at position 1, etc. Thus, the three bars at position 1 correspond to the totals for the three diseases in January. MATLAB determines the order by the column position. Thus, the bars in group 1 correspond to the January totals for measles, mumps, and chicken pox, respectively. EXAMPLE 7: Create a stacked bar chart of monthly totals bar(bymonth./1000, 'stack') xlabel('month') title('childhood diseases by month in NYC: 1931 1971') legend('measles', 'Mumps', 'Chicken pox')

Questions What does each bar in this graph represent? What does each band in this graph represent? How is the order of the bands determined within each bar? How do the groupings in Examples 6 and 7 differ? Why use stacked bar charts? The total height of each bar corresponds to the total of a row of bymonth (in thousands). For example, bar 1 is the total number of cases of all three diseases for January. Each element in bymonth corresponds to one band in this graph. The bands in bar 1 correspond to the 3 elements in the first row of bymonth, that is, the totals of each of the three diseases for January. MATLAB shows the bands in the column order of elements, with the value in column 1 shown on the bottom. Thus, the band at the bottom of bar 1 corresponds to the total number of cases of measles for January. Each group plots the same elements, but the 'stack' option draws the bands on top of each other in a single bar, while the other version draws the bands as side by side bars. A stacked bar chart allows you to better estimate and compare the overall totals of the groups. You can comprehend a larger number of groups with the stacked bars. The chart of Example 6 is rather crowded. EXAMPLE 8: Create horizontal stacked bar chart using a different color scheme (colormap) Create a new cell in which you type and execute: colormap spring barh(bymonth./1000, 'stack')

xlabel('cases (in thousands)') ylabel('month') title('childhood diseases by month in NYC: 1931 1971') legend('measles', 'Mumps', 'Chicken pox') You should see a Figure Window containing a labeled horizontal stacked bar chart that uses a spring color scheme: Questions How does the horizontal bar chart in this example differ from the vertical bar chart of Example 7 How do the orientations of vertical and horizontal bar charts differ? What is a color map? What determines how colors are assigned? What is spring? The two types of charts show the same information, but MATLAB draws these charts in a different orientations. For the vertical bar chart, MATLAB draws the bars in an up and down orientation and the displays groups from left to right. For the horizontal bar chart, MATLAB draws the bars in a side ways orientation and displays the groups from bottom to top. Many details can be changed by setting properties. A color map is a way of assigning colors based on integers. For example, there is a color 1, color 2, etc. MATLAB keeps a table of colors for each designated by the Colormap property. You can change this property for a by using the colormap command or by directly editing the. MATLAB has several standard tables of colors, and spring designates one of those standard tables.

These questions were written by Kay A. Robbins of the University of Texas at San Antonio and last modified on 23 Jan 2015. Please contact krobbins@cs.utsa.edu with comments or suggestions. Published with MATLAB 8.3