Python Review.

Post on 18-Jan-2018

234 views 0 download

description

Iteration Start Stop Increment Number for x in sequence: print x Start: x = sequence[0] Stop: x = sequence[len(sequence) – 1] Increment: values in sequence Number: len(sequence)

Transcript of Python Review.

Python Review

IterationStartStopIncrementNumber for x in sequence:

print x

Start: x = sequence[0]Stop: x = sequence[len(sequence) – 1]Increment: values in sequenceNumber: len(sequence)

IterationStartStopIncrementNumber for x in range(10):

print x

Start: x = 0Stop: x = 9Increment: 1Number: 10

IterationStartStopIncrementNumber

for x in range(0, 12, 2): print x

Start: x = 0Stop: x = 10Increment: 2Number: 6

range(0, 12, 2) [0, 2, 4, 6, 8, 10]

IterationStartStopIncrementNumber

x = 0while x <= 10: print x x = x + 2

Start: x = 0Stop: x > 10Increment: 2Number: 6

Iteration

x = 0while x <= 10: print x x = x + 2

x = 0while x <= 10: print x

x = 0while x <= 10: x = x + 2 print x

while x <= 10: x = 0 print x x = x + 2

Go Forever

2 4 6 8 10 12

All Zeros

Color in Visualization

CMSC 120: Visualizing InformationLecture 4/24/08

3 or more dimensions hard to visualize

Projection into lower-d space distorts data

Multifunctioning Graphical Elements

Multivariate Visualization

ColorPre-attentive

1000s of different colors20-30 gray tonesPatterns, boundaries, movement

Color PurposesEmphasisAppealDimensionality

Hello, here is some text. Can you read what it says?Hello, here is some text. Can you read what it says?Hello, here is some text. Can you read what it says?Hello, here is some text. Can you read what it says?Hello, here is some text. Can you read what it says?Hello, here is some text. Can you read what it says?

Shape of Nautilus Shell

Diameter in mm185 190 195 200 205 210 215 220

Wid

th in

mm

86

88

90

92

94

96

98

100

102

104

106FemaleMale

Color

ColorThe quality of an object with respect to the light

reflected by the object

Determined visually by:• Hue: color• Saturation: purity• Brightness: % black

Color

Types of ColorsAdditive Colors

All visible colors are a sum of two or more

Primary ColorsRed, Green, Blue

SubtractiveComplementary ColorsRemoving an additive

color from white light

Representing ColorEncoding

RGBCMKY = 1 - RGB

Choosing the Right ColorHuman matches 16-20 colors

Addition of pattern elements

< 10 -12

> 20 can no longer be pre-attentively processed

VGA Monitor16 colors262,144 (643)

Super VGA256 colorsSeveral million

How much and which colors?

Color Schemes

Color SchemesColor may carry standardized meanings in

particular applications.

blue = water bodiesgreen = vegetationbrown = desert/mountainswhite = ice or snow, etc.

Color maps

2004 Election

Elevational map of KansasSimilar colors: subclassesDissimilar: barriers/unrelated

Complementary ColorsOpposites on the color

wheel

High ContrastVibrant (full saturation)Can be jarring

Make something stand out

Bad for text

Analogous ColorsAdjacent on Color Wheel

SereneComfortableFound in NaturePleasing

Contrast can be problematic

Use black, white, gray as an accent

Analogous ColorsAdjacent on Color Wheel

SereneComfortableFound in NaturePleasing

Contrast can be problematic

Use black, white, gray as an accent

Triadic ColorsEvenly spaced

Vibrant, even when pale hues are used

Balance color useOne dominateOthers accent

Warm and CoolColorsCool colors

Short wave lengthviolet, blue, cyan, green large regionsfeatures for which no special

emphasis is desired

Hot colorsLong wavelengthyellow, orange, red, magenta

(long wavelength). Best used for small regions features for which special

emphasis is desired

Hot and Cool ColorsColor Stereoscopic Effect

cool colors appear farther awayhot colors appear closer. enhanced by using black boundaries between color

areas, a small contour interval, and bright high-saturation or fluorescent