Designing Effective Graphics Using MATLAB The Cain Project

Designing Effective Graphics Using MATLAB The Cain Project in Engineering and Professional Communication Linda Driskill, driskila@ruf. rice. edu Gang Cheng, gang@rice. edu

The Purpose of Using Graphs • In problem solving n As part of design n As analysis of operating data • For persuasion and interpretation n Dramatize relationships n Promote identification n Make complex information accessible 2

Checklist for Good Graphics • Purpose clear? • Critical components defined? • Pattern and arrangement lead eye without distraction? • Graphic hierarchy consistent? • Fonts legible? • Presenter’s expertise shown? 3

Types of Graph in Matlab • Line graph n n 2 D 3 D • Bar graph • Pie graph • Ribbon graph 4

Considerations • Purpose n n Problem solving? Persuasion and interpretation? • Audience n n What are their background? What are they interested to know? • Context n n Presentation? Report/Paper? 5

Context • Presentation n Big fonts Can use any color Can use animation • Report n n n Smaller fonts Often just black and white Animation impossible 6
![An Example • You have: n n n Vector 1: x[0: 0. 2: 10]; An Example • You have: n n n Vector 1: x[0: 0. 2: 10];](http://slidetodoc.com/presentation_image_h2/a93a7dac0a7ebfc23691f7a8070909b5/image-7.jpg)
An Example • You have: n n n Vector 1: x[0: 0. 2: 10]; Vector 2: sin(x); Vector 3: cos(x); • You are asked to: n n n Plot sin(x) vs. x and cos(x) vs. x in the same figure; Customize the figure so that it becomes suitable for being used in a presentation. Customize the figure so that it becomes suitable for being used in a report/paper. 7
![A Simple Matlab Program %start clear all; %clear the memory X=[0: 0. 2: 10]; A Simple Matlab Program %start clear all; %clear the memory X=[0: 0. 2: 10];](http://slidetodoc.com/presentation_image_h2/a93a7dac0a7ebfc23691f7a8070909b5/image-8.jpg)
A Simple Matlab Program %start clear all; %clear the memory X=[0: 0. 2: 10]; %define the x vector sinx=sin(x); %calculate sin(x) cosx=cos(x); %calculate sin(x) plot(x, sinx, x, cosx); %plot the lines xlabel('x'); %add x label ylabel('y'); %add y label title([‘sin and cos Functions']); %add title %end 8

Default Figure Given by Matlab 9

We Want … • Titles and labels bigger. • Lines thicker. • Colors more contrasting. • Insert Legend. • Data points shown. • Try adding gridlines. 10

Anatomy of a Matlab Figure title Y label Tick and tick label Axes lines X label 11

Open the Property Editor Figure Properties 12

Edit Figure Properties Figure Immediate apply 13

Edit Axes Properties axes 14

Edit Line Properties line 15

A Better-Looking Figure 16

Insert Legend legend 17

Legend Inserted Select object 18

Make Room for Legend 19

Edit Legend Properties legend 20

Insert Y Grid Line axes Grid Show 21

Final 22

Figure for Report/Paper 23

Frequently Used Functions • • “plot” “xlabel”, “ylabel” “title” “xlim”, “ylim” “axis” “legend” “errorbar” • Type “help function name” in Matlab command window for detailed information on the usage of the function. 24

Other 2 D Plotting Functions • “loglog”: graph with logarithmic scales for both axes. • “semilogx”: graph with a logarithmic scale for x-axis and a linear scale for y-axis. • “semilogy”: graph with a logarithmic scale for y-axis and a linear scale for x-axis. • “plotyy”: graph with y-tick labels on the left and right side. 25

A Whole Lot More … • 2 D contour n n “contour” “contourslice” • 3 D plots n n n “plot 3” “mesh” “surf” • Movie n n “getframe” “movie” 26

Sample Movie A Bioartificial Tissue Seeded with Cells Z = 40 Z=1 A movie created with mesh, getframe and movie 27
- Slides: 27