Top Banner
Designing Effective Graphics Using MATLAB The Cain Project in Engineering and Professional Communication Linda Driskill, [email protected] Gang Cheng, [email protected]
27

Designing Effective Graphics Using MATLAB

Dec 30, 2015

Download

Documents

Blake Greer

Designing Effective Graphics Using MATLAB. The Cain Project in Engineering and Professional Communication Linda Driskill, [email protected] Gang Cheng, [email protected]. The Purpose of Using Graphs. In problem solving As part of design As analysis of operating data - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Designing Effective Graphics  Using  MATLAB

Designing Effective Graphics Using MATLAB

The Cain Project in Engineering and Professional Communication

Linda Driskill, [email protected]

Gang Cheng, [email protected]

Page 2: Designing Effective Graphics  Using  MATLAB

2

The Purpose of Using Graphs

• In problem solving As part of design

As analysis of operating data

• For persuasion and interpretation Dramatize relationships

Promote identification

Make complex information accessible

Page 3: Designing Effective Graphics  Using  MATLAB

3

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?

Page 4: Designing Effective Graphics  Using  MATLAB

4

Types of Graph in Matlab

• Line graph 2D 3D

• Bar graph

• Pie graph

• Ribbon graph

Page 5: Designing Effective Graphics  Using  MATLAB

5

Considerations

• Purpose Problem solving? Persuasion and interpretation?

• Audience What are their background? What are they interested to know?

• Context Presentation? Report/Paper?

Page 6: Designing Effective Graphics  Using  MATLAB

6

Context

• Presentation Big fonts Can use any color Can use animation

• Report Smaller fonts Often just black and white Animation impossible

Page 7: Designing Effective Graphics  Using  MATLAB

7

An Example

• You have: Vector 1: x[0:0.2:10]; Vector 2: sin(x); Vector 3: cos(x);

• You are asked to: 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.

Page 8: Designing Effective Graphics  Using  MATLAB

8

A Simple Matlab Program

%startclear all; %clear the memoryX=[0:0.2:10]; %define the x

vectorsinx=sin(x); %calculate sin(x)cosx=cos(x); %calculate sin(x)plot(x,sinx,x,cosx); %plot the linesxlabel('x'); %add x labelylabel('y'); %add y labeltitle([‘sin and cos Functions']); %add title%end

Page 9: Designing Effective Graphics  Using  MATLAB

9

Default Figure Given by Matlab

0 1 2 3 4 5 6 7 8 9 10-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

x

y

sin and cos Functions

Page 10: Designing Effective Graphics  Using  MATLAB

10

We Want …

• Titles and labels bigger.

• Lines thicker.

• Colors more contrasting.

• Insert Legend.

• Data points shown.

• Try adding gridlines.

Page 11: Designing Effective Graphics  Using  MATLAB

11

Anatomy of a Matlab Figure

0 1 2 3 4 5 6 7 8 9 10-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

x

y

sin and cos Functionstitle

Y label

X label

Tick and tick label

lines

Axes

Page 12: Designing Effective Graphics  Using  MATLAB

12

Open the Property Editor

Figure Properties

Page 13: Designing Effective Graphics  Using  MATLAB

13

Edit Figure Properties

Figure

Immediate apply

Page 14: Designing Effective Graphics  Using  MATLAB

14

Edit Axes Properties

axes

Page 15: Designing Effective Graphics  Using  MATLAB

15

Edit Line Properties

line

Page 16: Designing Effective Graphics  Using  MATLAB

16

A Better-Looking Figure

0 2 4 6 8 10-1

-0.5

0

0.5

1

x

y

sin and cos Functions

Page 17: Designing Effective Graphics  Using  MATLAB

17

Insert Legend

legend

Page 18: Designing Effective Graphics  Using  MATLAB

18

Legend Inserted

Select object

Page 19: Designing Effective Graphics  Using  MATLAB

19

Make Room for Legend

Page 20: Designing Effective Graphics  Using  MATLAB

20

Edit Legend Properties

legend

Page 21: Designing Effective Graphics  Using  MATLAB

21

Insert Y Grid Line

axes

Grid

Show

Page 22: Designing Effective Graphics  Using  MATLAB

22

Final

0 2 4 6 8 10-1.5

-1

-0.5

0

0.5

1

1.5

x

y

sin and cos Functions

sin(x)cos(x)

Page 23: Designing Effective Graphics  Using  MATLAB

23

Figure for Report/Paper

0 2 4 6 8 10-1.5

-1

-0.5

0

0.5

1

1.5

x

y

sin and cos Functions

sin(x)cos(x)

Page 24: Designing Effective Graphics  Using  MATLAB

24

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.

Page 25: Designing Effective Graphics  Using  MATLAB

25

Other 2D 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.

Page 26: Designing Effective Graphics  Using  MATLAB

26

A Whole Lot More …

• 2D contour “contour” “contourslice”

• 3D plots “plot3” “mesh” “surf”

• Movie “getframe” “movie”

Page 27: Designing Effective Graphics  Using  MATLAB

27

Sample Movie

surfaces theallon 0.1 : B.C.

tissuet the throughou0 :I.C.

=

=

C

C

A Bioartificial Tissue Seeded

with CellsZ = 40

Z = 1

A movie created with mesh, getframe and

movie